June 25th, 2016
1. Just Deploy the same on Heroku
Remember your heroku ID and app address. ex: https://APP_ADDRESS.herokuapp.com/
2. Create a Facebook Page
Make sure you already have Facebook account, if you need use FB Bot.
3. Go to Facebook Developer to create App
Create App, need select as follow:
- New App type [Web App], create app
- Add new product [Messenger]
4. Configuration Messenger Bot
Get token from Faccebook page.
- Select a “Page” you own.
- Go to “Meseenger” product.
- It will generate
token
- copy it and store it.
5. Paste Token to Heroku
Go to heroku dashboard, go to “Setting” -> “Config Variables”.
- Add “Config Vars”
- Name -> “TOKEN”
- Value use
token
facebook app.
6. Back Facebook App configuration
- Go to “Messenger” product
- Go to “Setup Webhooks”
- Fill
https://APP_ADDRESS.herokuapp.com/webhook
in callback URL. - Fill your
token
in “token”. - Checked the checkbox “message_deliveres”, “messages”.
If your configuration is correct, it will show “completed”.
Also remember to choose correct page in this setting.
7. Request basic permissions
In Messenger application review, press “Request Premission”.
- Checked the “pages_messaging”.
How to testing it.
- Go to your spcific “page” in Facebook.
- Press “Send Message”
How to modification your Bot Code
- Download code from Heroku
git clone https://git.heroku.com/APP_ADDRESS.git
- Modify code on
main.go
first. especially inMessageReceived()
. - Commit and push it back to heroku
git push heroku master
.