Setup for rapid development of bots for Facebook Messenger.
Facebook Messenger works via https
, so the possibilities of local development are limited. In case you iterate fast you need to constantly redeploy your app to remote https-powered server (like Heroku, for example).
DevKit requires you to set up your app with webhook handler once. After that you have access to the stream of events via eventsource
. There're two files: server.js
is meant to be spinned on the remote https-powered server, while index.js
ought to be run locally and include your bot's logic.
You'd better get rid of eventsource
proxy in production. It's trival task and it's up on you.
-
Create app on Facebook
-
Add the Validation Token and remember it as
MESSENGER_VALIDATION_TOKEN
for step 5 -
Go to your Facebook app settings and navigate to
Webhook
tab. Add your newly created Heroku app as webhook. -
Set up
MESSENGER_VALIDATION_TOKEN
in Heroku Dashboard under Settings tab (you need to click 'Reveal Config Vars') -
Get the app url and add it to
index.js
asHEROKU_APP_URL
-
Read the Messenger Platfrom docs and go build something cool!
-
Better docs
-
Reusable factory functions for common tasks