Language AI Playbook
  • 1. Introduction
    • 1.1 How to use the partner playbook
    • 1.2 Chapter overviews
    • 1.3 Acknowledgements
  • 2. Overview of Language Technology
    • 2.1 Definition and uses of language technology
    • 2.2 How language technology helps with communication
    • 2.3 Areas where language technology can be used
    • 2.4 Key terminology and concepts
  • 3. Partner Opportunities
    • 3.1 Enabling Organizations with Language Technology
    • 3.2 Bridging the Technical Gap
    • 3.3 Dealing with language technology providers
  • 4. Identifying Impactful Use Cases
    • 4.1 Setting criteria to help choose the use case
    • 4.2 Conducting A Needs Assessment
    • 4.3 Evaluating What Can Be Done and What Works
  • 5 Communication and working together
    • 5.1 Communicating with Communities
    • 5.2 Communicating and working well with partners
  • 6. Language Technology Implementation
    • 6.1 Navigating the Language Technology Landscape
    • 6.2 Creating a Language-Specific Peculiarities (LSP) Document
    • 6.3 Open source data and models
    • 6.4 Assessing data and model maturity
      • 6.4.1 Assessing NLP Data Maturity
      • 6.4.2 Assessing NLP Model Maturity:
    • 6.5 Key Metrics for Evaluating Language Solutions
  • 7 Development and Deployment Guidelines
    • 7.1 Serving models through an API
    • 7.2 Machine translation
      • 7.2.1 Building your own MT models
      • 7.2.2 Deploying your own scalable Machine Translation API
      • 7.2.3 Evaluation and continuous improvement of machine translation
    • 7.3 Chatbots
      • 7.3.1 Overview of chatbot technologies and RASA framework
      • 7.3.2 Building data for a climate change resilience chatbot
      • 7.3.3 How to obtain multilinguality
      • 7.3.4 Components of a chatbot in deployment
      • 7.3.5 Deploying a RASA chatbot
      • 7.3.6 Channel integrations
        • 7.3.6.1 Facebook Messenger
        • 7.3.6.2 WhatsApp
        • 7.3.6.3 Telegram
      • 7.3.7 How to create effective NLU training data
      • 7.3.8 Evaluation and continuous improvement of chatbots
  • 8 Sources and further bibliography
Powered by GitBook
On this page
  • How to get the Facebook credentials
  • Running On Facebook Messenger
  1. 7 Development and Deployment Guidelines
  2. 7.3 Chatbots
  3. 7.3.6 Channel integrations

7.3.6.1 Facebook Messenger

Previous7.3.6 Channel integrationsNext7.3.6.2 WhatsApp

Last updated 1 year ago

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.

  1. To create the app, head over to and click on My Apps → Add New App.

  2. 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.

  3. 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.

  4. Locate the App Secret in the app dashboard under Settings → Basic. This will be your secret.

  5. 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.

  6. 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.

  7. 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 .

To use https on localhost, please check:

Running On Facebook Messenger

Add the Facebook credentials to your credentials.yml:

facebook:
verify: "rasa-bot"
secret: "<secret>"
page-access-token: "<token>"

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:

sudo docker-compose logs -f nginx

Try a message on messenger and you should be able to see the following:

nginx_1 | some_ip - - [09/Sep/2021:06:12:06 +0000] "POST /webhooks/facebook/webhook HTTP/1.1" 200 7 "-" "facebookexternalua" "-"

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. 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:

Facebook for Developers
Messenger docs
Setup HTTPS on localhost for testing the API/Channels
test users
https://developers.facebook.com/docs/app-review/resources/sample-submissions/messenger-platform