The Facebook Messenger engagement adaptor enables you to create a custom integration with ServisBOT using Facebook Messenger.
To create a Facebook Messenger based adaptor, you will need to setup the following:
Facebook Page - A Facebook page that will be used as the identity of your Facebook Messenger experience, see here for creating a Facebook page https://www.facebook.com/pages/create.
Facebook Developer Account - A Facebook developer account which is required to create new applications that integrate with Facebook services such as Facebook Messenger. More on this can be found here https://developers.facebook.com/.
Facebook App - A Facebook app associated with your developer account that contains the settings for your Facebook Messenger experience. More on this can be found here https://developers.facebook.com/apps. When prompted about the app usage choose “Manage Business Integrations”. This allows you to use Facebook Messenger within your application.
A guide on setting up each of these pieces can be found here https://developers.facebook.com/docs/messenger-platform/getting-started/app-setup/
Once you have completed the steps outlined above navigate to your Facebook App dashboard and do the following:
openssl rand -base64 45 | tr -d "/@\"\ " | cut -c-24
To allow ServisBOT to interact with your Facebook Messenger application you must create a ServisBOT secret containing the necessary information to allow ServisBOT to send a receive messages from your Facebook Messenger application.
{
"Name": "<YOUR_SECRET_NAME>",
"Type": "secretdoc",
"Value": {
"AppSecret": "<YOUR_FACEBOOK_APP_SECRET>",
"VerifyToken": "<YOUR_VERIFY_TOKEN>",
"PageAccessToken": "<YOUR_FACEBOOK_PAGE_ACCESS_TOKEN>"
}
}
To communicate with ServisBOT via your Facebook Messenger Application you must create a new ServisBOT endpoint to use as the webhook url for your Facebook Messenger events. Create an endpoint using the following definition and replacing and placeholders that are mentioned below:
{
"Address": "<YOUR_ORGANIZATION>-FacebookAdapter",
"OutboundBotReference": "FacebookAdapterBot",
"InboundBotReference": "FacebookAdapterBot",
"EngagementType": "FacebookMessenger",
"Status": "online",
"AllowedDomains": [
"*.production.helium.servismatrix.com",
"*.production.helium.servismatrixcdn.com",
"*.servisbot.com",
"https://servisbot.com"
],
"EngagementConfig": {
"Secret": "<YOUR_SECRET_SRN>"
},
"TargetBotReference": "FacebookAdapter",
"Name": "FacebookAdapterEndpoint",
"Useragent": "useragent"
}
Navigate back to your Facebook Application dashboard.
Go to Messenger Settings here
Go to the Webhooks section in the Messenger Settings.
Enter the callback url, the callback url takes the following form:
https://engagement.<sb-region>.servisbot.com/picard/v1/engage/<endpoint-address>
https://engagement.eu-1.servisbot.com/picard/v1/engage/<ENDPOINT-ADDRESS>
https://engagement.us-1.servisbot.com/picard/v1/engage/<ENDPOINT-ADDRESS>
Enter the Verify Token that you generated and included in your ServisBOT secret for your endpoint configuration. The Verify Token was generated in the Create a Verify Token section.
Click Verify and Save
Finally, we need to choose what the webhook subscribes to. Click the Add Subscriptions button on new your webhook.
Check the messages checkbox and save.
Your Facebook Messenger can now send and receive messages from ServisBOT.
Dialogue
Input
Markup
List
DetailView