Facebook Bot
This service is deprecated. It will be deleted in 217 version of SentiOne Automate. Since version 216, Facebook bots can be configured in Channels module and the component responsible for communication with Facebook is Channels Connector.
General description
Facebook Bot is a component responsible for providing bridge between Facebook Messenger API and SentiOne Automate. It allows to conduct conversations with Automate bots using Facebook messenger.
User's messages are being delivered to the application through webhooks technology so that it is important to make sure this component is exposed in a way those webhooks can be delivered.
API
Default port: 5760
Application has got HTTP API which is secured by verification of payload signature made with secret token that is shared between facebook and the component.
There are default endpoints for monitoring purposes. They are described in Components monitoring section.
Databases
This application connects to RabbitMQ in order to persist all incoming messages and to guarantee they will be processed even in case of temporary downtime of application.
Communication
This service communicates with the following services:
Application | Config to URL | Auth |
---|---|---|
Facebook Graph API | chatbots.facebook-bot.api.facebook-url | OAuth |
gateway | chatbots.gateway-api.url | None |
To register webhooks, you need to go to Facebook Developer website, and in Application setting in section Webhooks register endpoint. For example: https://facebook.example.com/webhooks - remember to add /webhooks path at the end. Verify token should be the same as in application config in field "webhook-token". It can be any string as long as in the config and in Facebook Developer settings you provide same token.
Config
Application's config:
chatbots.facebook-bot {
api {
# Facebook Graph API Url
facebook-url: "https://graph.facebook.com"
}
bots: [
{
# project ID from Automate
bot-id: "{BOT ID}",
# your fanpage id, can be fetched using https://findmyfbid.in/ or similar apps
fanpage-id: "{YOUR FANPAGE ID}",
# Facebook application id.
application-id: "{YOUR_APPLICATION_ID}"
# can be retrieved using application panel, graph api tool or from sentione database (it must be page access token!)
page-access-token: "{YOUR TOKEN}",
# webhook token provided when subscribing for webhooks
webhook-token: "{WEBHOOK TOKEN}",
# can be foundin the facebook app settings
app-secret: "{APP SECRET}", # can be foundin the facebook app settings
# this is where we transfer thread whenDialogStateActionTest using transfer:agent, this is OPTIONAL! By default thread will be transferred to Messagenger inbox
transfer-app: "263902037430900", # default FB inbox APP
# How long the bot will be "typing". When 0 bot wont be typing at all (no flicking). OPTIONAL with default: 1 second
typing-time: 0 seconds
}
]
webhooks-messaging {
message-timeout: 15s
}
}
Other required configurations:
# actual address for gateway service
chatbots.gateway-api.url: "<http://host:port>"
chatbots.messaging {
rabbit {
hosts: ["HOST:PORT"]
username: "USER"
password: "PASSWORD"
}
}
Job execution
None
Troubleshooting
Nothing yet.
Additional resources
Messenger API
How does the Messenger Platform work?
When a person sends a message to a business on Messenger and as long as this Page uses an app to partially or fully automate conversations, the following will happen. Our server sends webhooks to the URL of the business server, where the messaging app is hosted. Using the Send API, the app can respond to the person on Messenger. In this way, developers can build guided conversations to lead people through an automated flow or build an app to serve as a bridge between your agents and your business presence on Messenger.
Quote from official Facebook documentation.
Resources
https://developers.facebook.com/docs/graph-api/
https://developers.facebook.com/docs/messenger-platform/reference
https://developers.facebook.com/docs/messenger-platform/reference/handover-protocol
Updated over 1 year ago