7.3.6.1 Facebook Messenger
To serve your chatbot through Facebook Messenger, you first need to set up a Facebook page and app to get credentials. Once you have them, you can add them to your credentials.yml.
How to get the Facebook credentials
You need to set up a Facebook app and a page.
To create the app, head over to Facebook for Developers and click on My Apps → Add New App.
Go onto the dashboard for the app, and under Products, find the Messenger section and click Set Up. Scroll down to Token Generation and click on the link to create a new page for your app.
Create your page and select it in the dropdown menu for the Token Generation. The shown Page Access Token is the page-access-token needed later on.
Locate the App Secret in the app dashboard under Settings → Basic. This will be your secret.
Use the collected secret and page-access-token in your credentials.yml, and add a field called verify containing a string of your choice. Start Rasa run with the --credentials credentials.yml option.
Set up a Webhook and select at least the messaging and messaging_postback subscriptions. Insert your callback URL, which will look like
https://<host>:<port>/webhooks/facebook/webhook
, replacing the host and port with the appropriate values from your running Rasa X or Rasa Open Source server.Insert the Verify token, which has to match the verify entry in your credentials.yml.
CONFIGURE HTTPS
Facebook Messenger only forwards messages to endpoints via https, so take appropriate measures to add it to your setup.
For more detailed steps, visit the Messenger docs.
To use https on localhost, please check: Setup HTTPS on localhost for testing the API/Channels
Running On Facebook Messenger
Add the Facebook credentials to your credentials.yml:
Restart your Rasa X or Rasa Open Source server to make the new channel endpoint available for Facebook Messenger to send messages to.
Debugging
To check the activity on the webhook, we can see the nginx logs:
Try a message on messenger and you should be able to see the following:
If you are not able to see a log like the one above, then the integration is not done properly, so we need to check the credentials and try again.
Making the bot available to public
With the above integration, the bot can only be tested by the test users. To make it public, we need to submit the application for App Review by requesting pages_messaging permission/feature. Furthermore, check out a sample submission here:
https://developers.facebook.com/docs/app-review/resources/sample-submissions/messenger-platform
Last updated