Facebook Messenger Integration¶
Connect your AI assistant to Facebook Messenger for automated customer conversations.
Requirements at a Glance
- Active Facebook Business Page
- Admin access to the Page
- Messaging enabled in Page settings
What You Get¶
Automated Responses¶
Your AI assistant responds to Messenger conversations on your Facebook Page.
24/7 Availability¶
Handle customer inquiries around the clock without additional staffing.
Unified Inbox¶
All Messenger conversations appear in your Functional AI dashboard.
Requirements¶
| Requirement | Details |
|---|---|
| Facebook Page | Active Facebook Business Page |
| Page role | Admin access to the Page |
| Functional AI | Active account with configured assistant |
Setting Up the Integration¶
Step 1: Prepare Your Facebook Page¶
- Ensure you have a Facebook Business Page
- Verify you have admin access
- Enable messaging on your Page settings
Step 2: Connect in Functional AI¶
- Go to Integrations or Social in your dashboard
- Find Facebook Messenger integration
- Click Connect
Step 3: Authorize with Facebook¶
You'll be redirected to Facebook's OAuth authorization flow. This secure process lets you grant Functional AI access to manage Messenger conversations on your Facebook Page.
Understanding the Permissions¶
| Permission | Why We Need It | What We Can Do | What We Can't Do |
|---|---|---|---|
| pages_messaging | To read and send messages | View incoming messages, send replies | Post on your Page or access other Page content |
| pages_manage_metadata | To access Page information | Get Page name, ID, and basic info | Change Page settings or roles |
| pages_read_engagement | To read comments (if enabled) | View comments on your posts | Delete comments or moderate content |
Page-Level Permissions
Messenger permissions are tied to your Facebook Page. You must be an admin of the Page to connect it.
Authorization Steps¶
- You'll be redirected to Facebook's authorization screen
- Log in to your Facebook account (if not already logged in)
- Select the Facebook Page(s) you want to connect
- Review the permissions requested
- Click Continue to grant permissions
- Confirm the Page selection
What happens behind the scenes
sequenceDiagram
participant User
participant FunctionalAI
participant Facebook
participant Messenger
User->>FunctionalAI: Click "Connect Messenger"
FunctionalAI->>Facebook: Redirect to OAuth with scopes
Facebook->>User: Show Page selection & permissions
User->>Facebook: Select Page & approve
Facebook->>FunctionalAI: Return authorization code
FunctionalAI->>Facebook: Exchange code for Page access token
Facebook->>FunctionalAI: Return long-lived token
FunctionalAI->>Messenger: Subscribe to webhook events
Messenger->>FunctionalAI: Confirm webhook subscription
FunctionalAI->>User: Connection successful
Token Management: - Long-lived Page access token (60+ days) - Automatic token refresh - Encrypted storage (Fernet) - Webhook verification (HMAC-SHA256)
Step 4: Configure Settings¶
After connecting:
- Select which assistant handles Messenger
- Enable chat webhooks
- Set response delay (optional)
- Save settings
Configuration Options¶
Basic Settings¶
| Setting | Description |
|---|---|
| Enable chat webhooks | Toggle auto-responses |
| Assistant | Select responding assistant |
| Response delay | Add delay before responding |
Response Delay¶
Configure natural timing:
- Instant: Immediate response
- Short (5-15 sec): Brief pause
- Medium (15-30 sec): More natural
- Long (30-60 sec): Very human-like
Advanced Options¶
| Option | Description |
|---|---|
| Greeting message | First message users see |
| Away message | Response when disabled |
| Escalation keywords | Words that flag for human review |
Best Practices¶
Assistant Instructions¶
Optimize for Messenger conversations:
You are the customer support assistant for [Brand] on Facebook Messenger.
Communication style:
- Friendly and conversational
- Keep messages concise
- Use short paragraphs
- Respond to one question at a time
You can help with:
- Product information
- Order status inquiries
- General questions about [Brand]
If you can't help:
- Acknowledge the limitation
- Offer to connect them with a human
- Provide alternative contact: support@example.com
Conversation Design¶
Do: - Keep messages short (under 320 characters ideal) - Break long responses into multiple messages - Use friendly, conversational tone - Provide clear next steps
Don't: - Send walls of text - Use overly formal language - Ignore the conversational context - Spam with promotional content
Managing Conversations¶
Viewing Messenger Messages¶
- Go to Conversations
- Filter by Messenger channel
- View all conversation threads
Manual Replies¶
For conversations needing personal attention:
- Open the conversation
- Review the full thread
- Type your reply
- Send
Handling Escalations¶
Set up automatic flagging: - Customer frustration signals - Specific keywords - Request for human
See Channel Rules.
Message Flow¶
User messages your Page
↓
Facebook sends webhook
↓
AI assistant processes message
↓
Response sent via Messenger
↓
User receives reply
↓
Logged in dashboard
Attachments¶
Receiving Attachments¶
When users send you files, images, or videos via Messenger:
- We display them in your Conversations dashboard
- Media remains hosted on Meta's servers (we store a link)
- Attachments may expire over time as Meta manages their CDN
Supported incoming types: Images, videos, audio, files, stickers
24-Hour Window & Attachment Expiration
You can only send free-form messages within 24 hours of the user's last message. Messenger media links may also expire over time.
Sending Attachments¶
When replying manually from the Conversations dashboard:
| Message Type | Supported Attachments |
|---|---|
| DMs | Images, videos, audio, files |
| Page Comments | Text only (no attachments) |
Messenger has broader file support than Instagram - you can send documents, PDFs, and other file types in DMs.
AI and Attachments¶
The AI assistant is aware when users send media but cannot analyze image, video, or document contents. Consider training your assistant to:
- Acknowledge when files are received
- Ask clarifying questions about the content
- Offer human support for document reviews
Platform Guidelines¶
Facebook's Policies¶
- Standard messaging: Respond within 24 hours
- Message tags: Required for messages outside 24-hour window
- Content: Follow Facebook Community Standards
- Automated: Follow Facebook's automation policies
Response Window¶
You can respond freely within 24 hours of user's last message. After that, limited message types are allowed.
Webhook troubleshooting
Facebook Messenger uses webhooks to notify us of new messages in real-time.
Common Issues:
| Symptom | Likely Cause | Solution |
|---|---|---|
| No webhooks arriving | Subscription not active | Reconnect Messenger account |
| Webhooks delayed | Facebook platform lag | Check Facebook Status |
| Some messages missing | Rate limit hit | Reduce message volume |
| Signature verification fails | App secret mismatch | Reconnect integration |
Webhook Events: - messages, messaging_postbacks, message_deliveries, message_reads
Security: - Signature verification (HMAC-SHA256) - Duplicate prevention (5-minute window) - Rate limiting (100 webhooks/user/minute)
Troubleshooting¶
Quick Diagnostics¶
| Problem | Check | Fix |
|---|---|---|
| Can't connect | Admin of Page? Messenger enabled? | Verify admin access and Page settings |
| No messages | Webhooks active? Page published? | Check integration settings, reconnect |
| No responses | Within 24 hours? Assistant public? | Check timestamp, make assistant public |
Standard Messaging Window
You can send free-form messages within 24 hours of the user's last message.
Detailed connection troubleshooting
Can't Connect:
- Admin access to Facebook Page
- Messenger enabled on Page
- Page is published (not unpublished)
- No restrictions on Page
Steps: 1. Facebook Page > Settings > Page Roles (verify admin) 2. Page Settings > Messaging (ensure enabled) 3. Clear previous authorizations: Facebook Settings > Business Integrations 4. Try connecting from different browser
Messages not appearing
- Send test message to your Page (should appear within 5-10 seconds)
- Check integration settings for error badges
- Verify Page Messenger settings: "Allow people to contact my Page privately" is ON
- Check Facebook platform status
Responses not sending
24-Hour Window Check: - Calculate time since user's last message - If > 24 hours: Cannot send free-form message - If < 24 hours: Check other issues
Common Issues: - Private assistant → Make assistant public - No assistant selected → Select in integration settings - Invalid token → Reconnect Messenger - Page unpublished → Publish the Page - Test manually in dashboard to isolate issue
Privacy Considerations¶
Data Handling¶
- Follow Facebook's data policies
- Inform users about AI assistance
- Provide human escalation path
User Experience¶
Consider adding to your Page: - Information that AI assists with messages - Hours for human support - Alternative contact methods
Testing¶
Before Launch¶
- Test from a personal account
- Send various message types
- Verify responses are appropriate
- Check dashboard logging
Quality Assurance¶
- Review conversations regularly
- Identify common issues
- Refine assistant instructions
- Monitor response quality
Multiple Pages¶
If you manage multiple Facebook Pages:
- Each Page can be connected separately
- Different assistants can handle different Pages
- All conversations aggregate in your dashboard
- Filter by Page in Conversations view
Next Steps¶
- Set up Instagram (complements Messenger)
- Configure channel rules
- Monitor conversations