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#

  1. Log in to AlonChat
  2. Select your agent
  3. Go to Deploy > Facebook Messenger
  4. 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 messages
  • pages_read_engagement -- Read comments and interactions
  • pages_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#

  1. Send a message to your Facebook Page from a test account
  2. Verify agent responds automatically
  3. Test handoff phrase: "I want to speak to a human"
  4. Check that conversation appears in AlonChat dashboard

How It Works#

Message Flow#

Code
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#

ModeDescription
OffNo automatic comment replies
Auto ReplyAgent replies to matching comments automatically
DraftAgent drafts replies for you to review before sending

Reply Style#

StyleDescription
PublicAgent posts a public reply visible to everyone
PrivateAgent sends a private message to the commenter
SmartAI decides whether to reply publicly or privately based on the comment content

Comment Filters#

FilterDescription
AllReply to all comments
QuestionsOnly reply to comments that contain a question
NegativeOnly reply to negative or complaint comments

Example flow:

Code
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:

  1. Trigger phrase detected (e.g., "speak to human")
  2. Agent responds: "Let me connect you with our team. They'll be with you shortly."
  3. Notification sent to your team (email, Slack, etc.)
  4. Auto-reply paused for that conversation
  5. 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:

Code
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.submit event 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:

Code
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:

  1. Integration status:

    • Go to Deploy > Facebook Messenger
    • Ensure Facebook is "Connected" (green)
    • If not, click "Reconnect"
  2. Agent is trained:

    • Go to Sources
    • Ensure agent has been trained recently
    • Re-train if you added new sources
  3. Response mode:

    • Check Facebook deploy settings
    • Ensure "Auto-Reply" is toggled on for the page
    • If "Only When Offline", check business hours
  4. Facebook permissions:

    • Go to Facebook Page > Settings > Advanced Messaging
    • Ensure "Connected Apps" shows AlonChat
    • Re-authorize if missing
  5. Webhook health:

    • Check the health indicator on the deploy page
    • Should show healthy status
    • If degraded, try disconnecting and reconnecting

Delayed Responses#

Possible causes:

  1. AI model is slow:

    • Go to Settings > AI
    • Switch to a faster budget model (1 credit)
  2. Large source library:

    • Retrieval may be slow with 100+ sources
    • Optimize by removing duplicate content
  3. 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:

  1. Disconnect Facebook integration
  2. Wait 5 minutes
  3. Reconnect Facebook page
  4. Test with fresh message

Agent Says "I don't know"#

Causes:

  • Your sources are missing relevant information
  • Question phrasing doesn't match sources

Fix:

  1. Add missing information in Sources:

    • Upload documents
    • Create Q&A pairs
    • Add text sources
  2. Re-train agent

  3. Test with exact phrases used by customers


Handoff Not Working#

Symptoms: Handoff phrase doesn't trigger human takeover

Fix:

  1. Review handoff trigger settings
  2. Add the exact phrase used by customer
  3. 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:

  1. 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")
  2. Filter matches the comment:

    • If filter is set to "Questions", only question comments trigger replies
    • Try setting filter to "All" for testing
  3. Page permissions:

    • Ensure pages_read_engagement permission is granted
    • Re-authorize if needed

Disconnecting Facebook Page#

To disconnect a Facebook Page:

  1. Go to Deploy > Facebook Messenger
  2. Find the connected page
  3. Click the disconnect option
  4. 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#