- For setting up a Hubot instance, see here
- Install hubot-fb into your Hubot instance using by running
npm install -save hubot-fb
in your Hubot's root.
Now we'll create the Facebook Page your bot will send and receive as, and the Facebook App that will be used to manage it from Facebook's end.
- Create a Facebook Page here
- Set your
FB_PAGE_ID
fromhttps://www.facebook.com/<YOUR PAGE USERNAME>/info?tab=page_info
.
- Set your
- Create a Facebook App here.
-
Go to your app dashboard, and set your
FB_APP_ID
andFB_APP_SECRET
from there. -
Click "Messenger" on the App Dashboard sidebar. It should look something like this:
-
Under "Token Generation", select a page, and copy the page access token that is generated:
-
Set your
FB_PAGE_TOKEN
environment variable as the page access token you copied. This will allow your bot to send as your page. -
Pick an alphanumeric string and set it as your
FB_VERIFY_TOKEN
.
- Launch your hubot instance using hubot-fb by running
bin/hubot -a fb
(edit your Procfile to do the same on a Heroku-hosted instance) - You're now set up to send and receive messages to your hubot instance from Facebook Messenger.