How to connect Facebook Messenger to an AI Agent
Integration with Facebook Messenger allows the AI agent to automatically process incoming messages from users via a company’s Facebook Page. The AI agent can carry on full conversations on behalf of the page and respond to user queries in real time.
Preparation: Create an App in Facebook Developer Console
- Go to Facebook for Developers.
- Click Create App and follow the steps in the app creation wizard.
- After creating the app:
After this, new configuration sections will appear in the menu.
- Open the Add Product section from the left menu.
- Add the following products:
- Messenger
- Webhooks
Obtain Tokens and Page ID
- Go to: Messenger → Messenger API Settings
- In the Generate Access Tokens section:
- Link your desired Facebook Page.
- Click Generate Token and save it — you’ll need it to set up the integration.
- Also copy the Facebook Page ID for your page.
Set Up the Integration in Flametree
- Open the Integrations section.
- Find the Facebook Messenger integration type, click Add +, and fill in the fields:
Field | Description |
---|---|
Name , Description | Custom name and description for the integration. |
Facebook Page ID | Page ID (from the Generate Access Tokens section). |
Facebook Bot Token | Generated token (Access Token). |
Facebook Verify Token | Arbitrary string for webhook verification (save it for the next step). |
Switching the App to Production (Live Mode)
By default, the AI agent will only receive messages from page administrators. To make it available to all Facebook users:
- Go to: App Settings → Basic
- Fill in all required fields:
Display Name
Privacy Policy URL
Category
App Icon
- Toggle the switch to App Mode: Live