Facebook Messenger Integration
Documentation

Integration with Facebook Messenger

Follow this step-by-step guide to integrate Facebook Messenger with your MyBot chatbot. At the end of this tutorial, your Facebook Page user can chat with your AI Chatbot via Messenger App (both browser and mobile app).

Prerequisites

Ensure that you have the following requirements first to start this tutorial.

  1. MyBot account: You should have an existing MyBot account and a chatbot already created. If not, follow this tutorial to get started.
  2. Meta Developer account: You'll need a Meta (Facebook) Developer account to use WhatsApp Business API.
  3. Meta Business Portfolio You'll need a Meta Business Portfolio to create a Meta App
  4. Meta App You'll need a Meta App to setup any integration.

1. Set Up Facebook Messenger

From the developer dashboard, select a Meta App you created before. If you do not have a Meta App yet, click here to see how to create a Meta App before proceeding.

  1. From the Meta App's developer page, select an App Messenger Setup Example

  2. From the Meta App's dashboard, look for Messenger and click on Set up. Messenger Setup Example

  3. Now you should see Messenger API Settings page where you can connect this App to a Facebook Page. We are doing Step 2 on this page first because we need to generate access token to create webhook on MyBotChat. Messenger Setup Example

  4. Link your Facebook Page to the Messenger product in the app settings. Messenger Setup Example

  5. This step is tricky you need to generate access token first in order to setup webhook, which is in step 1 of "Messenger API Settings" page. So, click Generate button and save this access token for use later. API Access Example API Access Example

2. Create Webhooks API In Your MyBotChat for Integration

  1. Log in to MyBotChat and go to "My Chatbots" page and click on "Integrations" Webhook Setup Example
  2. Click "Set up" under messenger Webhook Setup Example
  3. Paste Facebook Access Token you got from previous step above. Webhook Setup Example
  4. Copy Verify Token and Webhook API URL for use the next step in Meta App's dashboard.
  5. Click "Save"

3. Set Up Webhooks for Facebook Messaging

Back into Meta Developer portal and select the App you are working on.

  1. Go to Messenger > Messenger API Settings and click Configure in step 1. Webhook Setup Example
  2. Paste the Verify Token and Webhook URL from your MyBot setup page. Webhook Setup Example
  3. Click Verify and save button
  4. Go back to Step 2 and click on Add subscription button Add subscriptions
  5. Select messages and messaging_postback Add subscriptions

4. Test the Integration

  1. Send a test message from Facebook Messenger to your linked Facebook Page.
  2. In your MyBot account, you should see this message received and processed by your chatbot.

Example screenshot of testing the integration:

Test Integration Example

An unhandled error has occurred. Reload 🗙