Facebook Messenger
Connect your Facebook Page to Tavio so customers can message your institution through Facebook Messenger and receive AI-powered responses.
Prerequisites
- A Facebook Page for your institution
- A Meta Developer account
- A Meta App with the Messenger product added
Required Credentials
| page_id | Your Facebook Page ID |
| access_token | Page Access Token (long-lived) from Meta App settings |
| app_secret | Meta App Secret for webhook signature verification |
Webhook URL
Messenger and Instagram share the same Meta webhook endpoint:
Meta Webhook (shared with Instagram)
text
https://bankmind.aihookd.site/api/v1/channels/meta/webhookWebhook Verification
When you register the webhook URL in your Meta App, Meta sends a GET request to verify ownership. Tavio handles this automatically:
Verification request from Meta
text
GET /api/v1/channels/meta/webhook
?hub.mode=subscribe
&hub.verify_token=YOUR_VERIFY_TOKEN
&hub.challenge=CHALLENGE_STRINGTavio returns the hub.challenge value if the verify token matches, completing the handshake.
Message Flow
- Customer sends a message to your Facebook Page via Messenger
- Meta forwards the event to your webhook URL
- Tavio verifies the
X-Hub-Signature-256header using your app_secret - The message is processed through the AI pipeline
- Response is sent via the Meta Send API
Inbound Payload
Messenger webhook payload
json
{
"object": "page",
"entry": [{
"id": "PAGE_ID",
"time": 1700000000,
"messaging": [{
"sender": { "id": "USER_PSID" },
"recipient": { "id": "PAGE_ID" },
"timestamp": 1700000000,
"message": {
"mid": "msg_abc123",
"text": "What are your savings account options?"
}
}]
}]
}Sending Responses
Send API call (handled by Tavio)
bash
curl -X POST "https://graph.facebook.com/v18.0/me/messages" \
-H "Content-Type: application/json" \
-d '{
"recipient": { "id": "USER_PSID" },
"message": { "text": "We offer several savings options..." },
"access_token": "PAGE_ACCESS_TOKEN"
}'