- ngrok account
- ngrok downloaded
- node.js 16.14.2
-
pull from the git repo
-
make sure node is installed
-
install dependencies
npm install express body-parser request
Make sure you have an ngrok account
- use the command
ngrok.exe http 5000
to run a local server on port 5000 (what our chatbot runs on) save the url that appears on the console
- run the application with the command
node index.js
to test if the app is up and running, visit the url given to you by ngrok
-
go to developers.facebook.com and create a messenger app
- if you do not have a facebook page create one
-
generate token and put it in the app in the command line
export TOKEN={your token here}
the callback url asked for is the url that was given to you by ngrok
the verify token is available on the dashboard of your ngrok account at https://dashboard.ngrok.com/get-started/setup
-
subscribe to messages, messaging_postbacks, messaging_optins and messaging_deliveries
-
use a curl command to test connection to facebook page
curl -X POST "https://graph.facebook.com/v2.6/me/subscribed_apps?subscribed_fields=message_deliveries&messages&messaging_optins&messaging_postbacks&access_token={your secret token here}"
-
heroku account
-
node.js 16.14.2
-
pull from the git repo
-
make sure node is installed
-
install dependencies
npm install express body-parser request
- login to heroku
heroku login
- create app
heroku create
- go into
.github/workflows/main.yml
and change the name of the app for your app's name
and change the email for your email
- Choose a verification token. Set it in the heroku config like this
heroku config:set VERIFY_TOKEN={your_token}
-
go to developers.facebook.com and create a messenger app
- if you do not have a facebook page to be used create one
- choose a 'Business' type app
- when asked to 'add products to your app', choose Messenger
-
generate web token and put it in the app in the command line
heroku config:set TOKEN={your token here}
add the token to github secrets as well: go to your repo settings -> secrets -> actions and add the token under HEROKU_API_KEY
the callback url asked for is the url of your heroku project
the verification token is the token you chose in step 1
- subscribe to messages, messaging_postbacks, messaging_optins and messaging_deliveries
5use a curl command to test connection to facebook page
curl -X POST "https://graph.facebook.com/v2.6/me/subscribed_apps?subscribed_fields=message_deliveries&messages&messaging_optins&messaging_postbacks&access_token={your secret token here}"
now if you message your page you should get a response!