Facebook Messenger: Deploy an Endpoint

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.

Three Step Preparation Process

1 Create a Facebook Page on Facebook
2 Create a Facebook App in the Facebook Developer Center
3 Create and Configure a Messenger Endpoint on Cognigy.AI

1 Create a Facebook Page

facebook.com

Requirements
✔ Facebook Account

1.1 Pages Overview

Log into your Facebook Account. Then on your landing page click on the Pages entry in the left navigation menu (see Figure 1.1)


Figure 1.1: Menu Entry for the Pages Overview

1.2 Create a Facebook Page

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.


Figure 1.2: Create Page Button

2 Create a Facebook App

Location: Facebook Developer Center

Requirements
✔ Facebook Account
✔ Facebook Page

2.1 Add new App

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)


Figure 2.1a: Menu entry for Manage Apps


Figure 2.1b: Apps menu

A prompt opens for creating a new Facebook App (see Figure 2.1c). Create the App entering the necessary information in the requested fields.


Figure 2.1c: Create New App Prompt

2.2 Add the Messenger Product

After creating the Facebook App you'll see an overview of the available products. Select Messenger by clicking set up (see Figure 2.2)


Figure 2.2: Messenger Product

2.3 Get the Page Token

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


Figure 2.3a: Navigation Menu for Products

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


Figure 2.3b: Access Tokens menu

After adding the page, press on Generate Token (See Figure 2.3c)


Figure 2.3c: Access token with added page

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**)


Figure 2.3d: Generate Token menu

Now you good to go to step 3 and set up the Messenger Enpoint with Cognigy.AI.

3 Create and Configure a Messenger Endpoint

Location: Cognigy.AI

Requirements
✔ Facebook Page Access Token

3.1 Create a Messenger Enpoint

First you have to create an Endpoint of the type Messenger (see Figure 3.1).


Figure 3.1: Messenger Endpoint Creating Prompt

3.2 Configure the Messenger Endpoint

Expand the Facebook Page Setup panel (see Figure 3.2) and paste the saved Page Access Token into the corresponding field.


Figure 3.2: Facebook Page Setup Panel

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.

3.3 Get the Endpoint URL

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


Figure 3.3: Endpoint URL

Final Step: Connect Your Facebook App to the Endpoint

Location: Facebook Developer Center

Requirements
✔ Endpoint URL

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


Figure 4.1: Webhooks Setup

As the Callback URL paste in the Endpoint URL which you gathered in step 3.3.

The Verify Token is by default


  6a1ed94ef26462d1a529ab80afabe135e5ac7cc8b414ef762e1208f3339f887196d3433c996c0f30ea15295fbd86293cd7516abaa9b9e78d641ebb514eea32b4
  

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)


Figure 4.2: Webhook details

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.


Figure 4.2: Edit subscription fields

You should be all set up to use the Messenger Endpoint you've created with a Flow of your choice.


Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.