Joining Botkit to Facebook using Azure Bot Framework
Things to note:
- The type of bot doesn't matter as most of the code in app.js will be overwritten with Botkit code.
- Under Settings => Configuration, change the Messaging endpoint to "https://{YOUR BOTS URL}/botframework/receive"
- In Application Settings, include the following empty environmental variables. They will be filled in later.
- access_token
- verify_token
- app_secret
To setup, follow the steps found in Configure Botkit and Facebook Messenger.
Adding Messenger as app product
Things to note:
-
For token generation:
- Create a Facebook page for your the Facebook app you created.
- Once created, return to the Token Generation setting, select your page, and create your token.
- Copy the token value.
- In your Azure bot Application settings, add the token value in for the 'access_token' key created earlier.
- Save your settings.
-
For webhook setup:
- Under Callback URL, enter the same URL entered as your Messaging endpoint in your Azure bot.
- "https://{YOUR BOTS URL}/botframework/receive"
- Create a verify token value and enter that. This is a made up value.
- Copy the verify token value.
- Select your subscription fields. Suggested values are:
- messages
- messaging_postbacks
- messaging_optins
- message_deliveries
- message_reads
- Click Verify and Save
- In your Azure bot Application settings, add the token value in for the 'verify_token' key created earlier.
- Save your settings.
- Under Callback URL, enter the same URL entered as your Messaging endpoint in your Azure bot.
-
Under your Facebook app settings (not the Messenger settings),
- Copy your App Secret value.
- In your Azure bot Application settings, add the token value in for the 'app_secret' key created earlier.
- Save your settings.
Unless your Facebook app is published, only approved roles will be able to test the bot
To test from your apps page:
- Click "+ Add a Button".
- Select "Contact you", then "Send Message".
- Click Next.
- Select "Facebook Messanger"
- Click Finish.
- Mouse over "Send Message" and select "Test Button"
To test from within Messenger:
- Add your Facebook app as a contact (if not already present)