by Paul Pinard

How to create a Facebook messenger bot for your page


When it comes to sharing your chatbot, Facebook Messenger is a must. We created a very easy step-by-step integration process for our platform users. Let’s dive in!

In fact, we realized many companies immediately put their bots on Facebook once in production, as it’s clearly the most user-friendly and easiest way for a customer to contact a company.

A Facebook chatbot has a lot of advantages:

  • 24/7 availability
  • 100% answers
  • Instant answers (think about your Answer rate!)
  • Tedious tasks are automated

On the SAP Conversational AI platform, we created a step-by-step integration process for our users, so that it only takes a few minutes to reveal your chatbot to your Facebook followers. Let’s dive in!

Step 1: Get your chatbot ready

First of all, you’ll need a chatbot (seems legit, right?!). Note that once your chatbot is online on Facebook, you’ll be able to modify it, and any changes you make to it will appear in your Messenger chat.

For the purpose of this tutorial, we won’t go into how to create a chatbot. Instead, I warmly invite you to create your account (it’s completely free!) and read our tutorial.

Once your “joke-telling chatbot” (or whatever you’ve built) is ready, return here!

Step 2: Get your Facebook page ready

Your chatbot will only be available for integration on a Facebook page (not on your personal profile). This means you have to create a Facebook page or have in mind the one you’ll use. Let’s assume your company, business, or group already has a page. (If that’s not the case, hit this link and create one.)

As I said in the introduction, having a chatbot on a Facebook page will automate private messaging once it’s connected to your page. Thus, if you decide to remove the chatbot, you’ll immediately revert to traditional person-to-person conversations (which means nothing will happen when users enter a message until you manually answer them).

Step 3: Create a Messenger Facebook app

Creating an app will help make the connection between SAP Conversational AI and your Facebook page. Without this app, you won’t be able to publish your chatbot on your Facebook page.

Click on this link, choose My Apps in the top menu and then Add New App.


Once your app is created, you’ll have to add a Messenger “product”.

There are tons of jobs a Facebook app can be dedicated to, but we specifically want a private messaging application. Go to your app’s dashboard and click Set Up in the Messenger box.


In the left-hand menu, you’ll then see Messenger under PRODUCTS.

Step 4: Get your page token and app secret

Now that we’ve created a Messenger app, we need to link it to your Facebook page (by default, a Facebook app is an independent entity). With this connection, you’ll be given a token, which is basically a unique code that says “OK, this is the code of the Messenger app of the page X”.

In the left-hand menu, click Settings just below the product Messenger.


Choose the page you want your chatbot to appear on.

For security reasons, you’ll probably need to allow the app to interact with your Facebook page. Click the blue Edit Permissions button, select your page, and check the different boxes.

Once the permissions are given, a token will be generated.


Go back to the Connect tab in your SAP Conversational AI chatbot, choose Messenger, and paste your token in the Page token field in step 4.

Yay, we’re halfway through! Let’s now get our “app secret”, which is like a password for your app.

In the left-hand menu, go to Settings > Basic.


For privacy, the app secret is hidden. Click Show and copy and paste it to the App secret field on your chatbot’s Connect tab (similar to what you just did with the page token).

Click Update channel under the SAP Conversational AI form.

Step 5: Connect SAP Conversational AI to your app

It’s time to connect our platform to Messenger!

On the Products > Messenger > Settings page, go to the Webhooks section and click Subscribe To Events.


In the pop-up window, enter the values for Callback URL and Verify token that you’ll find in step 4 of your chatbot’s Connect tab.


Also select the checkboxes shown below:


Once your page has reloaded, select your page in the list so that it can access your webhook.

Step 6: Test and publish the Messenger Chatbot

Now you can test your bot as an administrator (you can also grant some test roles using Roles > Test Usersin the left-hand menu). Your bot won’t be publicly accessible until you change the status, so take your time to test it and make sure everything is just fine before releasing it to the world!


Once you’re happy with your bot, if you change the toggle to ON (in the top right corner), you’ll be redirected to the settings and prompted to provide some extra information before your bot is published. (Tip: You can also access the settings under Settings > Basic in the left-hand menu.)


Very last step: Facebook will want to verify and test your Messenger chatbot. Here’s what they say about this step in their documentation:

When you are ready to release your bot to the public, you must submit it to our team for review and approval. This review process allows us to ensure your Messenger bot abides by our policies and functions as expected before it is made available to everyone on Messenger.” — Facebook Documentation

In the left-hand menu, go to Products > Messenger > Settings and click Add to Submission in the pages_messaging block.


It won’t take long for the Facebook review team to look at your bot and give you the green light to publish it!

And that’s all there is to it!

Hope you enjoyed this tutorial. And remember you’re very welcome to contact us if you need help, through the comment section below or via Stack Overflow.

Happy bot building ?