↓Skip to main content
  1. Articles/

Connect a Bot to Facebook Messenger

Table of Contents

Connect Facebook Messenger #


Content

Here is a step-by-step tutorial on how to connect a chatbot to your Facebook page.

Create a new bot #

Create a chatbot on the CKODA app by clicking on the “Create a new bot” button.

Give him a name #

Then click the “Continue” button!

Select Messenger channel #

After you create your project, select the Messenger channel.

This is recommended because it will allow you to have access to specific Messenger features, like Quick Replies or Cards.

If you didn’t select a channel at the beginning, you can choose one in the “Channels” tab of your platform. You can also add new channels and make it a multichannel chatbot.

Current view of the “Channels” tab:

If you click on the Facebook tab, a form opens with the fields you’ll need to fill in (Application secret, Page access token, Webhook verify token) — we’ll get these in the next steps.

Next, create and configure your Meta app.

Create your developer account and Meta app #

(Skip this step if you already have a Meta for Developers account and an existing app.)

Go to https://developers.facebook.com/apps and log in with your Facebook account.

Click “Create App” and follow Meta’s prompts to name it and finish creating it.

Among the proposed use cases, you can pick the one dedicated to Messenger directly:

Add Messenger to your app #

Once the app is created, find Messenger in the product list on the dashboard and click “Set Up”. You land on a use case customization dashboard:

Clicking the first row takes you to a “Customize use case” wizard with, in the left-hand menu:

  • Permissions and Features
  • Messenger API Settings
  • API Integration Assistant
  • Instagram Settings

Under “Permissions and Features”, you’ll see the list of available permissions (pages_messaging, pages_show_list, business_management, public_profile, etc.). Some already show a “Ready for testing” status — you don’t need to do anything with these as long as you stay in test mode (Admin/Developer/Tester accounts only).

Set up the webhook #

Go to “Messenger API Settings” (left-hand menu). You’ll find three sections there:

1. Set up the webhooks

  • Callback URL: paste the webhook URL provided by CKODA (visible at the bottom of the Messenger channel configuration window on the CKODA platform).
  • Verify token: paste the “Webhook verify token” generated/chosen on the CKODA side (you can use a password generator such as passwordsgenerator.net if CKODA doesn’t provide one directly).
  • Click “Verify and Save”.

Once validation succeeds, scroll down to “Webhook Fields” and subscribe to the following fields (the “Subscribe” toggle next to each row):

  • messages
  • messaging_postbacks
  • message_echoes

2. Generate access tokens

  • Click “Link” (Associer).

  • Select your Facebook Page from the list (you must be an admin of it), and accept the requested permissions.
  • Once the Page is linked, it appears in the table with a “Generate” button to get the token:

  • Click “Generate”: a Page access token is shown — copy it (it’s only displayed once).

Paste this token into the “Page access token” field on the CKODA platform.

A 3rd section, “Complete App Review” (Contrôle d’app), is also present on this page. It is not required at this stage: it is only used to request the pages_messaging permission for production (see the “Facebook validation” section below) and does not affect the bot’s operation in test mode.

Get the App Secret #

In the app’s menu, go to “Settings” > “Basic”.

Click “Show” next to the “App Secret” field. Facebook will ask for your password again.

Copy the value shown and paste it into the “Application secret” field on the CKODA platform.

⚠️ Critical, easy-to-miss step: subscribe the Page to webhook events #

This is the most common source of a silent failure: clicking “Link” (Associer) in step “2. Generate access tokens” is supposed to automatically subscribe your Page to the app’s webhook events. This automation can fail with no visible error in the UI. If your bot receives no messages even though everything looks correctly configured (webhook validated, token generated, secret filled in), this is very likely the cause.

How to check:

  1. Get a user token with the pages_show_list, pages_manage_metadata, and pages_messaging permissions via the Graph API Explorer.
  2. Fetch the matching Page token by calling:
    GET https://graph.facebook.com/v26.0/me/accounts?access_token=<YOUR_USER_TOKEN>
    
    The access_token field of the entry matching your Page is the Page token to use in the next calls.
  3. Check the current subscription:
    GET https://graph.facebook.com/v26.0/<PAGE_ID>/subscribed_apps?access_token=<PAGE_TOKEN>
    
    If the response is {"data": []}, your app is not subscribed to this Page’s events.
  4. Subscribe it manually:
    POST https://graph.facebook.com/v26.0/<PAGE_ID>/subscribed_apps?subscribed_fields=messages,messaging_postbacks,message_echoes&access_token=<PAGE_TOKEN>
    
    A {"success": true} response confirms it’s fixed.

📌 Missing screenshot — this check is done purely through the Graph API (curl, Postman, or the Explorer); there is currently no dedicated screen for it in the Meta for Developers UI.

Test your bot #

Send a message to your Page from Messenger (not from the Facebook Page itself if you’re an admin — the “Send Message” button doesn’t show up for admins; instead search for your Page’s name directly inside Messenger).

If everything is set up correctly, the bot should reply.

Next step: Facebook validation (App Review) #

For now, your chatbot is only accessible to people with a role (Admin, Developer, or Tester) on your Meta app. To allow everyone to use it, the app must go through Business Verification followed by a request for the pages_messaging permission in production — this verification is now mandatory for any app that wants to interact with the general public on Messenger.

Was this article helpful? #

Yes No

Need Support?

Can’t find the answer you’re looking for? Don’t worry we’re here to help!

More help