Skip to main content
The Facebook Messenger Endpoint enables you to connect AI Agents to the Facebook Messenger platform.

Prerequisites

Generic Endpoint Settings

Learn about the generic Endpoint settings on the following pages:

Specific Endpoint Settings

ParameterDescription
Facebook Page Access TokenA token generated by your Facebook App to authenticate the connection with Cognigy.AI.
App IDThe App ID of your Facebook App.
App secretThe App Secret of your Facebook App. For additional security, it verifies that messages are sent from Messenger.
ParameterDescription
Request profile dataFetches data from the user’s Facebook profile and stores in the ci.data.profile object. The ci.data.profile object will contain the following parameters:
  • Id – the Facebook user’s PSID, which is a unique user ID for each Facebook Page the user interact with.
  • first_name – the user’s first name.
  • last_name – the user’s last name.
  • profile_pic – a URL linking to the user’s profile picture.
  • locale – information about the user’s locale.
  • timezone – the user’s time zone.
  • gender – the user’s gender.

Note that the same data types are exposed in the profile object for every Facebook user. However, the actual values depend on the information available in their Facebook profile and on their privacy settings.
Update contact profilesUpdates the Contact Profile in Cognigy.AI with data from the user’s Facebook profile. If the setting is enabled, the information a Facebook user has on their profile will be copied to their Contact Profile.
Merge contact profilesEach Facebook user has a user’s PSID for each Facebook Page they interact with. This means that if you own two or more Facebook Pages, you can’t immediately identify users across these pages because they will have a different ID for each page. However, if you enable this setting, Cognigy.AI will fetch all of a user’s PSIDs for your pages and merge these profiles into one. This setting allows you to easily identify a single user across all your pages and personalize the chat experience more effectively. To perform the necessary API calls to get all the PSIDs for a user, the same Business must own all the Facebook Pages.
ParameterDescription
Enable typing indicatorsEnables a typing indicator while the bot is replying. You can configure whether typing indicators should be used and how many milliseconds of delay there should be between each message.
Message DelayThe amount of time to wait between sending bot replies, in milliseconds.

How to Set Up

  1. Log in to your Facebook account. Go to the Pages section.
  2. Click Create New Page, select a type (Business or Community), and provide a name and category.
  3. Go to the Facebook (Meta) Developer Center.
  4. Click Manage Apps, then Add a New App.
  5. Fill in the required details to complete the app creation.
  6. In your app’s product overview, locate Messenger and click Set Up.
  1. Go to Messenger > Access Tokens. Add the Facebook Page created earlier.
  2. Click Generate Token, acknowledge the warning, and copy the token.
  1. In the left-side menu of the Cognigy.AI Project, go to Deploy > Endpoints.
  2. On the Endpoints page, click + New Endpoint.
  3. In the New Endpoint section, do the following:
    1. Select the Messenger Endpoint type.
    2. Add a unique name.
    3. Select a relevant Flow from the list.
  4. Open the Facebook Page Setup section. Paste the Page Access Token from the Facebook App.
  5. (Optional) Enter your App ID and App Secret for additional security.
  6. Copy the Endpoint URL for later use.
  1. Go to the Facebook app. Under Messenger > Webhooks, click Add Callback URL.
  2. Paste the Endpoint URL as the callback URL.
  3. Enter the Verify Token from Cognigy.AI:
    • For https://trial.cognigy.ai, use the token 6a1ed94ef26462d1a529ab80afabe135e5ac7cc8b414ef762e1208f3339f887196d3433c996c0f30ea15295fbd86293cd7516abaa9b9e78d641ebb514eea32b4.
    • For other environments, contact Cognigy technical support for more information.
  4. Click Verify and Save.
  5. Add Subscription Fields: select messages, messaging_postbacks, and optionally messaging_referrals. Save the settings.

More Information

I