With the implementation of a Messenger Endpoint you can easily connect your Facebook Messenger Bot with COGNIGY.AI.
This tutorial covers the necessary steps for creating and connecting a Facebook Messenger Endpoint. If you want to get information about assigning a Flow to the Endpoint and setting up the Data Management see Endpoints.
Log into your Facebook Account. Then on your landing page click on the Pages entry in the left navigation menu (see Figure 1.1)
Click on the Pages link and you'll see an overview of your Facebook pages. Create a new one by clicking the green button in the top navigation bar (see Figure 1.2). You can choose any kind of page you want (business or community). Give it a name and a category and you're ready for step 2.
First, you've to log into your Facebook account. Then, after getting redirected, click on Manage Apps (see Figure 2.1a) and select Add a New App (see Figure 2.1b)
A prompt opens for creating a new Facebook App (see Figure 2.1c). Create the App entering the necessary information in the requested fields.
After creating the Facebook App you'll see an overview of the available products. Select Messenger by clicking set up (see Figure 2.2)
If you're on the overview page of your Facebook App go to the settings of the Messenger product of your app (see Figure 2.3a).
Scroll down to the Access Tokens section and add the page you've created in Step 1 by clicking in Add or Remove Pages. (see Figure 2.3b).
After adding the page, press on Generate Token (See Figure 2.3c)
Read the warning and check the "I Understand" box so the token will be revealed, copy the token and click done (see "Figure 2.3d**)
Now you good to go to step 3 and set up the Messenger Enpoint with COGNIGY.AI.
Facebook Page Access Token
First you have to create an Endpoint of the type Messenger (see Figure 3.1).
Expand the Facebook Page Setup panel (see Figure 3.2) and paste the saved Page Access Token into the corresponding field.
Optional Secret Validation
You can add an optional security layer and verify for every message that it was actually sent from Facebook Messenger. To do this, add your App ID and App Secret in the corresponding fields in your Endpoint Facebook Page Setup.
Move to the top of the Endpoint Configuration page and copy the Endpoint URL which is displayed above the General Settings (see Figure 3.3).
Switch back to your Facebook App and there to the settings page of the Messenger Product. Scroll to the Webhooks section and click on Add callback URL. A prompt opens and asks for (see Figure 4.1):
- a Callback URL
- a Verify Token
As the Callback URL paste in the Endpoint URL which you gathered in step 3.3.
The Verify Token is by default cognigy123 but it depends on the installation of your COGNIGY.AI platform (for further information please contact the technical support). Press Verify and save to continue.
After adding the Callback URL you will have a view with details about the webhook (see Figure 4.2)
Now we need to add "Subscriptions fields", press the Add subscription fields button, a prompt will open (see Figure 4.3) For the Subscription Fields select the messages and messaging_postbacks events. If you want to use referrals, you'll also need to subscribe to the messaging_referrals event.
Select the fields and press save.
You should be all set up to use the Messenger Endpoint you've created with a Flow of your choice.
Updated over 2 years ago