Facebook Channel Setup

Version: 4.1.x

Prerequisites

In order to set up a bot including a facebook channel you need to have set up the following prerequisites:

  1. Set up a Facebook Page https://www.facebook.com/business/learn/set-up-facebook-page
  2. Set up a Facebook App https://developers.facebook.com/docs/apps/register
  3. Go through the bot creation process but stop before the last step "Creating a Bot"

Creating the bot including the facebook channel

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:

bot
{
  "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