In order to set up a bot including a facebook channel you need to have set up the following prerequisites:
Go to https://developers.facebook.com
Log in with your facebook account and go to your already created app
Click on Add Product in the menu and select Messenger
Generate the page access token
Make a Post to /botstore/bots
with a json like this:
{ "packages" : [ "eddi://ai.labs.package/packagestore/packages/<PACKAGE_ID>?version=1" ], "channels" : [ { "type" : "eddi://ai.labs.channel.facebook" , "config" : { "appSecret" : "<FACEBOOK_APP_SECRET>", "verificationToken" : "<VERFICTATION_STRING_TO_ENTER_IN_WEBHOOK_CONFIGURATION>", "pageAccessToken" : "<FACEBOOK_PAGE_ACCESS_TOKEN_FROM_MESSENGER_CONFIGURATION>" } } ] } |
Deploy your bot as described in the Creating a bot page!
After deployment your webhook URL will look like this:
https://<hostname>/channels/facebook/<BOT_ID>?version=1
VERY IMPORTANT! The url needs to be https and the certificate needs to be an actual certificate of a valid certification agency. For free certificates have a look here: https://letsencrypt.org/!
Go to https://developers.facebook.com/apps/
Click on messenger in the menu and open the webhook setup.
Enter your bot url and the verification token that you entered, when creating the bot and add messages as a subscription
Deploy your facebook app and the bot is live