The Dialogflow Facebook integration allows you to easily create a Facebook Messenger bot with natural language understanding, based on the Dialogflow technology.
Setting Up Facebook
In order to set up the Facebook integration for your agent, you'll need the following:
- a Facebook account
- a Facebook page to add your agent to
When a user visits your page and sends you a message, they'll be talking to your agent.
Create a Facebook App
- Log into the Facebook Developer Console.
- Click on My Apps in the upper right hand corner.
- Click on Create App and enter a name and contact email address
Click Create App ID.
On the left side of the next page, click thebutton and add Messenger to Products.
Under the Token Generation section, click on Add or Remove pages to add a new page.
Click on Generate Token to generate an access token.
This will generate a Page Access Token. Keep this token handy, as you'll need to enter it in Dialogflow.
Setting Up Dialogflow
- Click on the Integrations option in the left menu and switch on
Facebook Messenger. In the dialog that opens, enter the following
- Verify Token - This can be any string and is solely for your purposes
- Page Access Token - Enter the token generated in the Facebook Developer Console
Click the Start button.
To configure your agent's webhook:
- Click the Add Callback URL button under the Webhooks section and
enter the following information:
- Callback URL - This is the URL provided on the Facebook Messenger integration page
- Verify Token - This is the token you created
- Click the Verify and Save button.
Click the Add Subscriptions button and check messages and messaging_postbacks under Subscription Fields, then save.
You'll be taken back to the settings page and Webhooks should have a "Complete" status.
In order to make your agent available for testing, you'll need to make your app public:
- Toggle the "Publish" button from OFF to ON. You are prompted to choose a category for your app.
- Choose Apps for Messenger from the list
- Click the Confirm button.
You will also need to set a username for your page. This is the username users will chat with when using your agent. To set the username, click the Create Page @Username link under your page's profile picture and title.