Back to documentation
Facebook Messenger
Let your chatbot answer the messages sent to your Facebook Page.
Prerequisites
- A Facebook Page you administer.
- A Meta developer account to create the app.
- An AgentPro chatbot that is Active, with knowledge added.
Setup
- 1
Create a Meta app and add Messenger
At Meta for Developers create an app of type Business and add the Messenger product. Connect the Facebook Page you want the chatbot to answer for and generate a Page access token. Note the Page ID, and the App ID and App secret from Settings → Basic. - 2
Create the channel in AgentPro
In the dashboard open Channels → Facebook Messenger, pick the chatbot that should answer and enter the page access token, page ID, app ID and app secret. AgentPro verifies the token against the page before saving. The channel is created with the status Pending verification. - 3
Add the webhook in your Meta app
In Messenger → Settings → Webhooks, set the callback URL to the one shown on the channel page:https://agentpro.chat/api/v1/webhooks/messenger/<channelId>The verify token is the channel secret shown next to the URL (copy it from the channel page; you can regenerate it there at any time). Subscribe to the
messagesandmessaging_postbacksfields. - 4
Verify
When Meta calls the callback URL with the correct verify token the channel switches to Active. Send a message to your page from a test account: the chatbot replies, and the conversation appears in your AgentPro inbox where an agent can take over.
How it works
- Each inbound message is checked against the signature Meta sends using your app secret.
- Messages create a conversation on the linked chatbot and are mirrored into the inbox.
- Pausing AI on a conversation in the inbox lets an agent reply from AgentPro; the reply is sent back through Messenger.
- Regenerating the channel secret invalidates the old verify token; update the Meta app and verify again.
Troubleshooting
- Verification failed: the verify token must match the channel secret exactly, and the callback URL must contain the channel ID shown in the dashboard.
- No replies: make sure the app is subscribed to the page and the
messagesfield, and that the chatbot linked to the channel is Active. - Invalid credentials when saving: the page access token must belong to the page whose ID you entered; regenerate it in the Meta app if it expired.