Configure your bot for Messenger
If you followed the guide Create your first bot with Tock Studio, you declared a Slack-type connector.
In this guide, you will create a configuration for Facebook Messenger and integrate the bot to communicate with it on this social network.
If you wish, you can also skip this step and go directly to the rest.
What you will create
-
A configuration (in Facebook and in Tock) to receive and send messages via Messenger
-
A bot that speaks on a Facebook page or in Messenger
Prerequisites
-
About 20 minutes
-
A functional Tock bot (for example following the guide first Tock bot)
-
A Facebook Developer account
Create a Facebook page
- Create a Facebook page
- Give it a name (e.g. My Tock Bot)
Recommendation: do not publish the page to limit its access to Messenger users: Settings > General > Page visibility > Not published
Create a Facebook application
-
Go to the page Facebook for developers > See all apps
-
Add an app
Create an app > Manage professional integrations
- Enter a name for the application
- Add a product: Messenger
Create a Messenger connector
- In Tock Studio go to Settings > Configurations :
- Create a connector of type Messenger and open the Connector Custom Configuration section
- Complete the fields (see below field by field):
- Application Id : it is found on your application page on https://developers.facebook.com
- Page Id : it is on the page linked to your application on https://facebook.com
- Call Token: The token can be found on your app page on https://developers.facebook.com
-
Webhook Token : choose any token (even
token
if you want) and write it down for later - every call to Tock from Facebook will be made passing this token -
Secret : copy from your user's page application on https://developers.facebook.com
-
Persona Id : you can leave this field empty
-
Check that the connector configuration is saved
Configure the callback URL
-
Go back to your app's configuration page on https://developers.facebook.com: Products > Messenger > Settings > Webhooks
-
Click Add Callback URL (or Edit Callback URL if you previously had a different URL)
-
Enter the URL where your Tock connector is currently deployed, and the webhook token you chose when configuring the connector
To find your connector's URL, go to the Tock Studio > Settings > Configurations configuration page, expand your Messenger connector configuration, and concatenate the contents of the Application base url field and the contents of the Relative REST path field.
-
Click Review and save
-
Test your bot on Messenger!
Congratulations!
Your bot now communicates on Messenger, in addition to the other channels you have integrated it into.
The conversational model, features and personality of your assistant are built and remain independent of the channels on which the bot is present. However, nothing prevents you from creating paths or responses specifically for a particular channel, as you will see through different Tock tools: Responses management screen, activation of intentions on a particular channel with the Story Rules screen, use of DSLs and the Bot API to take advantage of specific graphical components, etc.
Continue...
In the following sections you will learn how to:
-
Create programmed paths in Kotlin, opening the way to complex behaviors and integrating third-party APIs if needed
-
Deploy a Tock platform in a few minutes with Docker
To learn more about the Messenger connector provided with Tock, go to the connector-messenger folder on GitHub, where you will find the sources and the README of the connector.