Skip to content

Commit

Permalink
Merge pull request #101 from botpress/rohankokkulabp-patch-3
Browse files Browse the repository at this point in the history
updated messenger docs
  • Loading branch information
bassamtantawi-botpress authored Feb 7, 2023
2 parents a215d53 + 0908c13 commit f62fb52
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions docs/messaging-channels/direct-integrations/facebook-messenger.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ title: Facebook Messenger

## Requirements

You will need a Facebook app and a Facebook page to connect you bot to messenger
You will need a Facebook app and a Facebook page to connect you bot to messenger.

### Enabling Messenger in Botpress Cloud Dashboard

Go to the chatbot settings in your cloud dashboard and enable messenger.
We will get the APP ID, App Secret, Verify Token, Page ID and Access Token from the following steps.

### Create a Facebook App

Expand All @@ -31,47 +36,48 @@ The messenger channel is made to interact with version 12.0 or higher of the Mes
1. In the **Upgrade API version** section, select v12.0 or higher as the API version
1. Click on **Save changes**



### Add Messenger Product

Messenger is not added by default in your Facebook App, so it must be added manually

1. In the left sidebar, click on **Add Product**
1. In the Facebook Messenger section click **Set Up**
### App ID and App Secret

### App Id and Secret

The app id and secret are used to validate webhook requests
The App ID and secret are used to validate webhook requests

1. In the left sidebar, expand the **Settings** menu and select **Basic**. Here you can find the App ID and App Secret
1. Click on the **Show** button in the **App Secret** text box. Copy the App Id and App Secret to your channel configuration
1. In the left sidebar, expand the **Settings** menu and select **Basic**. Here you can find the App ID and App Secret.
1. Click on the **Show** button in the **App Secret** text box. Copy the App ID and App Secret to your messenger configuration in the Cloud Dashboard.

### Page Id and Access Token
### Page ID and Access Token

The page id and access token are used to send messages to the Messenger API
The page ID and access token are used to send messages to the Messenger API

1. In the left sidebar, expand the **Messenger** menu and select **Settings**
1. In the **Access Tokens** section, click **Add or remove Pages** and add you facebook page
1. Copy the number under you page name and paste it in you **Page Id** channel configuration
1. Click on **Generate token**. Copy this token and paste it in the **Access Token** channel configuration
1. Click on **Generate token**. Copy this token and paste it in the **Access Token** channel configuration in cloud dashboard.

### Verify Token

The verify token is used by facebook to verify that you are the real owner of the provided webhook
The Verify Token is used by facebook to verify that you are the real owner of the provided webhook.

You can generate any random alphanumerical string for this configuration. Paste it in your **Verify Token** channel configuration
You can generate any random alphanumerical string for this configuration. Paste it in your **Verify Token** channel configuration.

### Save Configuration

Channel configuration is complete, you can now click **Save**. It is important you save your configuration before configuring the webhook, otherwise Messenger will be unable to validate the webhook url
Channel configuration is complete, you can now click **Save**. It is important you save your configuration before configuring the webhook, otherwise Messenger will be unable to validate the webhook url.

## Webhook Configuration

To receive messages from Messenger, you will need to setup a webhook
To receive messages from Messenger, you will need to setup a webhook.

1. Go to your Facebook App.
1. In the left sidebar, expand the **Messenger** menu and select **Settings**
1. In the **Webhooks** section, click **Add Callback URL**
1. Copy paste the webhook url provided in the channel configuration UI
1. Copy paste the verify token you generated earlier
1. Click on **Verify and save**. Make sure your channel configuration was saved before doing this step, otherwise the webhook validation will fail
1. Click on **Add subscriptions** and add `messages` and `messaging_postbacks` to your webhook
1. Copy paste the webhook url provided in the channel configuration UI from cloud dashboard.
1. Copy paste the verify token you generated earlier.
1. Click on **Verify and save**. Make sure your channel configuration was saved before doing this step, otherwise the webhook validation will fail.
1. Click on **Add subscriptions** and add `messages` and `messaging_postbacks` to your webhook.

1 comment on commit f62fb52

@vercel
Copy link

@vercel vercel bot commented on f62fb52 Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.