In Slack2Watson(1) and (2) I created a chatbot and integrated it into Slack Slash Commands. Now, let’s integrate the same chatbot into Facebook Messenger. To accomplish this I need to create a Facebook Application, add the Messenger Platform to my Facebook Application, create a Webhook, have admin access to a Facebook Page to generate a Page Access Token so I can send and receive messages send to the Facebook Page, and create the Node-RED flows to integrate the Facebook Messenger with the IBM Watson Conversation.
- Create a Flow to Verify the Request for Webhook Edits in Node-RED,
- Create an Endpoint for the Redirect URL of the Webhook in Node-RED,
- Create a Facebook Application for the Messenger Platform,
- Enable Webhooks Integration with Node-RED,
Create a Flow to Verify the Request for Webhook Edits in Node-RED
To prepare the setup and configuration of the Facebook Application, the Messenger platform and Webhooks to enable a chatbot in Facebook Messenger, I will first create the Node-RED flows to implement the required server workflow.
The first flow is to verify the endpoint for the setup of the Facebook Application, using the ‘hub.challenge’ token.
- Go to your Node-RED application on Bluemix at http://<username>-nodered-slackapp.mybluemix.net/,
- Click the ‘Go to your Node-RED flow editor’ button,
- If you’re not logged in yet, log in now,
- Add a new flow tab and rename the flow ‘Facebook Messenger’,
- To verify your endpoint during setup of your Webhook, or when you update an existing topic subscription of your Webhook, Facebook sends a GET request. The request will include:
hub.challenge â€” a random string