Facebook Messenger

Facebook Messenger Integration

Messenger integration allow you to add your bot to Facebook Messenger.
To do that you have to follow these steps :

1- Click on messenger, this window will appear:

In this step you have to fill the Token verify
The token verify can be anything, but we recommend you use your bot/app name

2- Create your facebook page

If you already have a Facebook Page, skip this step

3- Go to Developers Facebook

4- Add a new App

5- After creating the new app you will be redirected to Product Setup, in this state you have to get Messenger started

6- Once the messenger has started you have to generate Page Access Token and copy it

7- Paste the Page Access Token in your messenger integration like that

8- Hit Deploy my App

9- Now in developers facebook go to set up webhook

  • Paste webhook url (get it from smartly messenger integration) into Callback URL
  • Paste token verify (get it from smartly messenger integration) into Verify Token
  • In Subscription Fields choose messages and messaging postpacks

10- To activate the bot you have to subscribe your webhook to the page events

Finally you can start talking to the Bot on Messenger

NodeJs : user_data

To Customize our Messages according to the attributes of messenger users (first name, last name etc…), for example if we want to say hello username how are you ? You have to go to the builder and add a NodeJs node then add these line of code:

output.answer = "hello "+messenger_user.first_name + " " +messenger_user.last_name + " How are you ?";

NodeJs : messenger_request

The same for messenger requests, if we want to get for example the facebook page of the sender we can add this line of code:

output.answer = "sender is :";

NodeJs : messenger_answer

If we want to add many elements like images, buttons, carousels etc… to the bot’s messages, we have to prepare our json containing all elements we need it, and push it in the messenger_answer table messenger_answer.push()

           "title":"Welcome to Smartly",
           "subtitle":"We've got the bot for everyone.",
           "default_action": {
             "type": "web_url",
             "url": "",
             "messenger_extensions": true,
             "webview_height_ratio": "tall",
             "fallback_url": ""
               "title":"View Website"
               "title":"Start Chatting",

Facebook Messenger

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.