Install flask & requests using pip:
pip install Flask
pip install requests
Install ngrok from - https://ngrok.com/.
Run the dev server using:
python server.py
Use ngrok to tunnel the connection.
ngrok http 5000
You shall see the url for your local server. Something like: https://6cecffb8.ngrok.io.
- Create a Facebook App.
- Add the
MessengerProduct. - Enable webhooks. Use the above URL as the callback webhook URL.
- Edit
server.pyand update theVERIFY_TOKENwith the token you set. - Once the callback is verified, subscribe the app to one of your pages.
- Also generate a page access token for that page.
- Edit
server.pyand update theACCESS_TOKENwith the new token we got.