To use Facebook Channel, you have to create a Facebook app in the developer portal. You can find more details about creating Facebook channels here
- In the select an app type, choose business
Once you register your Facebook App, you will have to obtain the
App Id and
App Secret. These values will be available in the app settings and will be required while setting up Chatwoot environment variables.
Configure the following Chatwoot environment variables with the values you have obtained during the Facebook app setup.
FB_VERIFY_TOKEN should be a unique secure string that should be provided when configuring the Facebook app.
Restart the chatwoot server after updating the environment variables
- In the app settings, add your
Chatwoot installation domainas your app domain.
- In the products section in your app settings page, Add Messenger
- Go to the Messenger settings and configure the callBack URL with
- provide the
FB_VERIFY_TOKENvalue from your environment variables for
- Head over to chatwoot and create a Facebook inbox. Choose a page for which your Facebook developer account has admin access to
Until the application is approved for production, Facebook wouldn't send the new messages on your page to chatwoot. To test the changes until the app is approved for production. Follow the steps
- Head over to the messenger section in your app settings page, in Facebook developers
- Under the pages table in the webhooks section, you will see the page you choose while creating the chatwoot Facebook inbox
- Click on add subscriptions and subscribe to the following
- Send a message to the connected page from your Facebook account and it should appear in chatwoot now
Before you can start using your Facebook app in production, you will have to get it verified by Facebook. Refer to the docs on getting your app verified.
Obtain advanced access to the required permissions mentioned below for your Facebook app
Install ngrok on your machine. This will be required since Facebook Messenger API's will only communicate via https.
Configure ngrok to route to your Rails server port.
Go to the Facebook developers page and navigate into your app settings. In the app settings, add
localhost as your app domain.
In the Messenger settings page, configure the callback url with the following value.
Update verify token in your Chatwoot environment variables.
You will also have to add a Facebook page to your
Access Tokens section in your Messenger settings page.
Restart the Chatwoot local server. Your Chatwoot setup will be ready to receive Facebook messages.
- After finishing the set-up above, create a Facebook inbox after logging in to your Chatwoot Installation.
- Send a message to your page from Facebook.
- Wait and confirm incoming requests to
/botendpoint in your ngrok screen.