Facebook Messenger Integration
Connect your Facebook Page to your AI agent for auto-replies to messages and comments
Facebook Messenger Integration#
Connect your Facebook Page to AlonChat to automatically respond to messages and comments 24/7. Your AI agent will handle customer inquiries, collect leads, and seamlessly hand off to human agents when needed.
Prerequisites#
Before you begin:
- Facebook Page (not personal profile)
- Page admin access
- Trained AlonChat agent
- Facebook Business Account (recommended)
Note: Personal profiles cannot be connected -- only Facebook Pages.
Step-by-Step Setup#
Step 1: Navigate to Deploy#
- Log in to AlonChat
- Select your agent
- Go to Deploy > Facebook Messenger
- Click Connect Facebook Page
Step 2: Log in to Facebook#
You'll see an OAuth popup to authorize the connection.
Required permissions:
pages_messaging-- Send and receive messagespages_read_engagement-- Read comments and interactionspages_manage_metadata-- Update page settings
Click Continue to grant permissions.
Step 3: Select Facebook Page#
Choose which Facebook Page to connect:
- If you manage multiple pages, select the one you want
- Connect different pages to different agents, or multiple pages to the same agent
- If a page is already connected to another agent, you'll see a conflict dialog with a transfer option
- Click Add More to connect additional pages
Click Connect Page.
Step 4: Configure Settings#
On the Facebook deploy page, configure:
- Greeting Text: First message visitors see
- Get Started Button: Custom welcome message/payload
- Ice Breakers: Conversation starters
- Quick Replies: Up to 13 quick reply buttons
- Persistent Menu: Custom menu items (postback or web URL links)
- Auto-Suggest Quick Replies: AI-generated contextual reply suggestions
- Custom AI Prompt: Override or append to default prompt for Messenger
- Learned Style: Use communication patterns from training
- Auto-Reply Toggle: Enable/disable per connected page
Step 5: Test the Integration#
- Send a message to your Facebook Page from a test account
- Verify agent responds automatically
- Test handoff phrase: "I want to speak to a human"
- Check that conversation appears in AlonChat dashboard
How It Works#
Message Flow#
User sends message to Facebook Page
|
Facebook sends message to AlonChat via webhook
|
AlonChat agent processes message (RAG retrieval)
|
Agent generates response using AI model
|
AlonChat sends response back to Facebook
|
User receives response in Messenger
Average response time: 2-5 seconds
Conversation Syncing#
AlonChat syncs all Facebook Messenger conversations:
- Real-time message sync (both directions)
- Conversation history preserved
- User profile information (name, profile picture)
- Message read receipts
- Typing indicators
View conversations: Go to Conversations tab in AlonChat dashboard to see all Facebook chats.
Features#
Auto-Response#
Agent automatically responds to:
- Direct messages to your page
- First-time messages
- Follow-up questions
- Messages during off-hours
Does NOT auto-respond to:
- Messages you already replied to (unless new question asked)
- Spam or abusive messages
- Messages from blocked users
Comment Auto-Reply#
Your agent can automatically reply to comments on your Facebook Page posts.
Configure in Deploy > Facebook Messenger, under the Comment Reply Settings section for each connected page.
Modes#
| Mode | Description |
|---|---|
| Off | No automatic comment replies |
| Auto Reply | Agent replies to matching comments automatically |
| Draft | Agent drafts replies for you to review before sending |
Reply Style#
| Style | Description |
|---|---|
| Public | Agent posts a public reply visible to everyone |
| Private | Agent sends a private message to the commenter |
| Smart | AI decides whether to reply publicly or privately based on the comment content |
Comment Filters#
| Filter | Description |
|---|---|
| All | Reply to all comments |
| Questions | Only reply to comments that contain a question |
| Negative | Only reply to negative or complaint comments |
Example flow:
Customer comments: "What time do you open on Saturdays?"
|
AlonChat detects question comment
|
Agent generates reply using your sources
|
Reply posted: "We're open 9 AM to 5 PM on Saturdays! Let us know if you need anything else."
Handoff to Human Agents#
When a user requests human assistance:
- Trigger phrase detected (e.g., "speak to human")
- Agent responds: "Let me connect you with our team. They'll be with you shortly."
- Notification sent to your team (email, Slack, etc.)
- Auto-reply paused for that conversation
- Human takes over in AlonChat dashboard or Facebook Page Inbox
Resume AI:
- Click "Resume AI Agent" in conversation view
- Agent will continue responding automatically
Lead Collection#
Agent can collect lead information during conversations:
Example conversation:
User: Do you offer custom t-shirt printing?
Agent: Yes! We offer custom printing with full-color designs.
Would you like to receive our pricing guide?
User: Yes please
Agent: Great! May I have your email address?
User: john@example.com
Agent: Thank you! I'll send the pricing guide to john@example.com.
What's your name?
User: John Doe
Agent: Thanks John! Would you like to provide your phone number
so we can discuss your project?
User: +639171234567
Agent: Perfect! We'll reach out to you shortly.
Lead captured:
- Name: John Doe
- Email: john@example.com
- Phone: +639171234567
- Source: Facebook Messenger
- Timestamp: 2026-03-22 10:30 AM
Webhooks triggered:
leads.submitevent fires automatically- Can integrate with external CRM tools, Google Sheets, and more
Quick Replies#
Quick replies appear as tappable buttons below agent messages, guiding customers through common conversation paths.
- Configure up to 13 quick reply buttons per page
- Agent can also auto-suggest contextual quick replies based on the conversation
- Users can tap buttons or type their response
Message Formatting#
Agent supports rich message formatting:
Text formatting:
- Bold, italic, strikethrough (Markdown syntax)
- Emojis
- Line breaks and paragraphs
Media:
- Images (sent as attachments)
- Files (PDFs, documents)
- Links (auto-preview in Messenger)
Best Practices#
1. Set Clear Expectations#
Add to your agent's system prompt:
You are an AI assistant for [Company Name].
Let users know you're an AI at the start of conversations:
"Hi! I'm [Company]'s AI assistant. How can I help you today?"
2. Configure Handoff Triggers#
Add these phrases to trigger human handoff:
- "speak to a human"
- "talk to a person"
- "real person"
- "customer service"
- "manager"
- "complaint"
3. Set Appropriate Response Time#
For customer support:
- Use 2-5 second delay (natural conversation feel)
- Show typing indicator
- Don't respond too fast (feels robotic)
For sales/marketing:
- Can use instant responses (0s delay)
- Emphasize speed and availability
4. Use Business Hours Wisely#
24/7 business:
- Set "Always Reply" mode
- Let AI handle all initial inquiries
- Have human review in morning
Office hours business:
- Set "Only When Offline" mode
- Business hours: 9am-5pm Mon-Fri
- AI covers nights, weekends
5. Monitor Conversations#
Check AlonChat dashboard daily:
- Review AI responses for accuracy
- Look for patterns in unanswered questions
- Add missing information to your sources
- Manually respond to complex queries
6. Train Your Agent#
Add Facebook-specific content in Sources:
- Common questions asked via Messenger
- Typical follow-up questions
- Messenger-specific FAQs
- Tone appropriate for social media
Troubleshooting#
Agent Not Responding#
Check these:
-
Integration status:
- Go to Deploy > Facebook Messenger
- Ensure Facebook is "Connected" (green)
- If not, click "Reconnect"
-
Agent is trained:
- Go to Sources
- Ensure agent has been trained recently
- Re-train if you added new sources
-
Response mode:
- Check Facebook deploy settings
- Ensure "Auto-Reply" is toggled on for the page
- If "Only When Offline", check business hours
-
Facebook permissions:
- Go to Facebook Page > Settings > Advanced Messaging
- Ensure "Connected Apps" shows AlonChat
- Re-authorize if missing
-
Webhook health:
- Check the health indicator on the deploy page
- Should show healthy status
- If degraded, try disconnecting and reconnecting
Delayed Responses#
Possible causes:
-
AI model is slow:
- Go to Settings > AI
- Switch to a faster budget model (1 credit)
-
Large source library:
- Retrieval may be slow with 100+ sources
- Optimize by removing duplicate content
-
High traffic:
- During peak hours, responses may slow
- Upgrade to higher-tier plan for better performance
Duplicate Responses#
Symptoms: Agent sends the same message twice
Causes:
- Facebook sends webhook twice (rare bug)
- Integration was connected multiple times
Fix:
- Disconnect Facebook integration
- Wait 5 minutes
- Reconnect Facebook page
- Test with fresh message
Agent Says "I don't know"#
Causes:
- Your sources are missing relevant information
- Question phrasing doesn't match sources
Fix:
-
Add missing information in Sources:
- Upload documents
- Create Q&A pairs
- Add text sources
-
Re-train agent
-
Test with exact phrases used by customers
Handoff Not Working#
Symptoms: Handoff phrase doesn't trigger human takeover
Fix:
- Review handoff trigger settings
- Add the exact phrase used by customer
- Case-insensitive, so "Human" = "human"
Default triggers:
- speak to a human
- talk to a person
- real person
- customer service
- manager
Comment Auto-Reply Not Working#
Check these:
-
Comment reply mode is enabled:
- Go to Deploy > Facebook Messenger
- Find the Comment Reply Settings section
- Ensure mode is set to "Auto Reply" or "Draft" (not "Off")
-
Filter matches the comment:
- If filter is set to "Questions", only question comments trigger replies
- Try setting filter to "All" for testing
-
Page permissions:
- Ensure
pages_read_engagementpermission is granted - Re-authorize if needed
- Ensure
Disconnecting Facebook Page#
To disconnect a Facebook Page:
- Go to Deploy > Facebook Messenger
- Find the connected page
- Click the disconnect option
- Confirm disconnection
What happens:
- Agent stops auto-responding
- Webhook is removed from Facebook
- Existing conversations are preserved
- Can reconnect anytime
Limitations#
- One agent per page: Each Facebook Page can only connect to one agent at a time
- Message limits: Facebook has rate limits (600 messages/min per page)
- No group chats: Agent only responds to 1-on-1 conversations
- 24-hour messaging window: Follow-ups outside this window may require template messages
Privacy and Compliance#
Data Collection#
AlonChat collects:
- Message content (encrypted at rest)
- User profile information (name, profile picture)
- Conversation timestamps
- Message read status
AlonChat does NOT collect:
- Facebook account passwords
- Private messages to other pages
- User's friend list
- User's posts or photos
GDPR Compliance#
AlonChat is GDPR-compliant:
- User data is encrypted
- Data is stored in secure servers
- Users can request data deletion
- Data is not sold to third parties
Data Retention#
- Active conversations: Retained indefinitely
- Archived conversations: 90 days (configurable)
- User deletion: All data deleted within 30 days
Next Steps#
- Instagram Integration -- Connect Instagram DMs and comments
- Telegram Integration -- Connect Telegram
- Webhook Examples -- Integrate with external systems