This is a test messenger bot app build with Python - Flask library. It connects to a facebook page via a token and respose to messages sent by clients to the facebook page.
- Python 3.6 or higher
- Flask
- pymessanger
- ptyhon-dotenv
- ngrok
- Install python libraries to run project
pip3 install -r requirements.txt
- Download ngrok
- Login to ngrok from your browser.
- Follow instructions here to connect to your account from your local machine.
- Login/Register to Facebook Developers site
- Create a new app

- Select Business app type then Click Continue

- Enter app name and Contact email Then click Create APP

- Select the Product Messenger and Click SetUp

- Create new facebook page or Add an Existing Page where you will use the bot.

- Generate an Access Token for the page. Copy and keep this token secrete and do not share with any one.

-
We would clone this repo
-
Navigate to the project root folder
-
create a .env file with fields
- -> VERIFIER_JETON=
"add any verificatio message here" - -> PAGE_ACCESS_TOKEN=
"add the token generated from facebook here"
- -> VERIFIER_JETON=
-
Now run the flask app
FLASK_APP=mybot.py flask run
- Navigate to where you downloaded the ngrok application and run ngrok.
./ngrock http 5000
- Copy the Fowarding url with https
https://230696fa7855.ngrok.io
- Go back to your facebook app settings and Edit the Webhook

- Insert the url you coppied adding
/webhookto hit the webhook endpoint served by the app
https://230696fa7855.ngrok.io/webhook



