Skip to content

Configure a bot for Messenger

If you followed the guide Create your first bot with Tock Studio, you created a connector with type Slack.

In this guide, you will create a configuration for Facebook Messenger and set up the bot to chat with it on this application.

What you will build

  • A configuration (in both Facebook and Tock) to send and receive messages through Messenger

  • A bot who can chat on a Facebook page or on Messenger

What you need

Create a Facebook page

  • Create a Facebook page

Créer une page partie 1

Créer une page partie 2

  • Give it a name (e.g. My Tock Bot)

Créer une page partie 3

Our advice: do not publish the page to limit its access by Messenger users: Settings > General > Page Visibility > Page unpublished

Create a Facebook App

For more details on creating an App, you can read the Facebook Developer Documentation.

Créer une application partie 1

  • Create App > Manage Business Integrations

Créer une application partie 2

  • Set your app name and email

Créer une application partie 3

  • Add a product: Messenger

Ajouter messenger Ă  une application partie 1

Ajouter messenger Ă  une application partie 2

Create a Messenger Connector

  • In Tock Studio go to Settings > Configurations:

Créer un connecteur messenger partie 1

  • Create a connector with type Messenger and open the Connector Custom Configuration section

Créer un connecteur messenger partie 2

  • Fill in the fields (see below for each field)

Connecter Tock partie 1

Trouver l'id d'application

ID de page partie 1

ID de page partie 2

Générer un token

  • Webhook Token: choose an arbitrary token (even token if you so wish) and note it down for later - Facebook will use it to call the Tock webhook

  • Secret: you can copy it from your app’s settings page at https://developers.facebook.com

Secret

  • Persona Id: you can leave this field empty

  • Check that the connector’s configuration is correctly saved

Configure the Callback URL

  • Go back to the configuration page for your application at https://developers.facebook.com: Products > Messenger > Settings > Webhooks

  • Click on Setup Webhooks

  • Input the URL at which your Tock instance is currently deployed, and the webhook token you chose earlier while configuring the connector

To retrieve your connector’s URL, go on the configuration page Tock Studio > Settings > Configurations, unroll your Messenger connector’s configuration, and concatenate the content of the field Application base url with that of the field Relative REST path.

  • Click on Verify and Save

  • Test your bot on Messenger!

Congratulations!

Your bot can now chat on Messenger, as well as on other channels you added connectors for.

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 specific paths or responses for a particular channel, as you will see through the various different Tock tools: Responses handling screen, activation of intentions on the channels of your choice with the Story Rules screen, use of DSLs and of the Bot API to take advantage of specific graphical components, etc.

Continue…

To learn more about the Messenger connector bundled with Tock, you can take a look at the connector-slack directory on GitHub, where you will find sources and the connector’s README.

To learn more about Tock Studio and about Tock’s features and deployment modes, you can also browse the more complete user guide.