Messenger Integration
Deploy OpenClaw on Facebook Messenger
Reach your audience where they already are. With over 1.3 billion active users, Facebook Messenger is one of the world's most popular messaging platforms. OpenClaw integrates with the Messenger Platform API to provide AI-powered conversations for personal assistance, customer service, marketing automation, and business communication at scale.
Setup Guide
Create Facebook App
Visit the Meta Developer Portal and create a new app with Messenger capabilities. You'll need a Facebook account and a Facebook Page to connect the bot to.
# 1. Go to https://developers.facebook.com/apps
# 2. Click 'Create App'
# 3. Select 'Business' type (for full Messenger features)
# 4. Fill in app details:
# - App Name: OpenClaw AI Assistant
# - Contact Email: your@email.com
# - Business Account: Select or create one
# 5. Add Messenger product:
# - Click 'Add Products'
# - Find 'Messenger' and click 'Set Up'
# You'll receive:
# - App ID
# - App Secret (keep secure!) Configure Messenger Settings
Set up Messenger-specific configuration including Page connections, access tokens, and webhook subscriptions. Generate Page Access Tokens for each Page the bot will serve.
# In Messenger Settings:
# 1. Generate Access Token:
# - Click 'Add or Remove Pages'
# - Connect your Facebook Page
# - Generate Page Access Token
# - Copy and save securely
# 2. Configure Webhooks:
# - Callback URL: https://yourdomain.com/messenger/webhook
# - Verify Token: your_custom_verify_token
# - Subscription Fields:
# - messages
# - messaging_postbacks
# - messaging_optins
# - message_deliveries
# - message_reads
# - messaging_handovers Install Messenger Bridge Module
Add the Messenger bridge to your OpenClaw installation. The bridge handles webhook verification, message processing, and response formatting according to Messenger Platform specifications.
# Using OpenClaw CLI
openclaw install messenger-bridge
# Or manual installation
cd /path/to/openclaw
npm install @openclaw/messenger-bridge
# Verify installation
openclaw plugins list | grep messenger Configure OpenClaw Connection
Create your Messenger configuration file with credentials and behavior settings. Configure multiple Pages if needed, set up message handling rules, and define response formats.
# config/messenger.yaml
messenger:
enabled: true
# App credentials
app_id: "YOUR_APP_ID"
app_secret: "YOUR_APP_SECRET"
verify_token: "your_custom_verify_token"
# Page configurations
pages:
- page_id: "YOUR_PAGE_ID"
access_token: "YOUR_PAGE_ACCESS_TOKEN"
name: "My Business Page"
# Webhook settings
webhook:
path: "/messenger/webhook"
port: 3000
# Response settings
response:
typing_indicator: true
typing_duration: 1000 # milliseconds
mark_seen: true
persona_id: null # Optional: custom bot persona Set Up Message Templates
Configure Messenger-specific templates for rich responses. Define quick replies, buttons, generic templates, and specialized formats for different use cases.
# config/messenger-templates.yaml
templates:
# Quick replies
quick_replies:
welcome:
- title: "Get Started"
payload: "GET_STARTED"
- title: "Learn More"
payload: "LEARN_MORE"
- title: "Contact Support"
payload: "CONTACT_SUPPORT"
# Button template
main_menu:
type: button
text: "How can I help you today?"
buttons:
- type: postback
title: "Ask a Question"
payload: "ASK_QUESTION"
- type: postback
title: "Browse Products"
payload: "BROWSE_PRODUCTS"
- type: web_url
title: "Visit Website"
url: "https://yourwebsite.com"
# Generic template (carousel)
product_carousel:
type: generic
elements_limit: 10
image_aspect_ratio: square Configure Persistent Menu
Set up the persistent menu that appears at the bottom of the chat. This provides always-available navigation options for users.
# config/messenger-menu.yaml
persistent_menu:
enabled: true
# Menu structure (up to 3 top-level items)
items:
- type: postback
title: "Main Menu"
payload: "MAIN_MENU"
- type: nested
title: "Help"
call_to_actions:
- type: postback
title: "FAQs"
payload: "FAQ"
- type: postback
title: "Contact Us"
payload: "CONTACT"
- type: web_url
title: "Visit Help Center"
url: "https://help.yoursite.com"
- type: postback
title: "Settings"
payload: "SETTINGS"
# Disable input for specific scenarios
composer_input_disabled: false
# Locale-specific menus
locales:
es_LA:
items:
- type: postback
title: "Menu Principal"
payload: "MAIN_MENU" Configure AI Response Behavior
Set up how OpenClaw AI processes and responds to Messenger conversations. Configure personality, response limits, and special handling for different message types.
# config/messenger-ai.yaml
ai_responses:
# Personality
personality: helpful_business_assistant
tone: professional_friendly
# Response limits
max_message_length: 2000
split_long_messages: true
# Message type handling
handlers:
text: ai_response
image: analyze_and_respond
audio: transcribe_and_respond
location: contextual_response
sticker: acknowledge
attachment: process_and_respond
# Postback handling
postbacks:
GET_STARTED: welcome_flow
MAIN_MENU: show_menu
FAQ: faq_handler
CONTACT: human_handover
# Handover configuration
handover:
enabled: true
trigger_phrases:
- "speak to human"
- "talk to agent"
- "customer service"
handover_app_id: "YOUR_INBOX_APP_ID" Submit for App Review
Before your bot can message anyone, you need to submit for Meta's App Review. Request the necessary permissions and prepare your app for review.
# Required Permissions for Full Functionality:
# - pages_messaging (basic messaging)
# - pages_messaging_subscriptions (subscription messaging)
# - pages_read_engagement (read page data)
# - pages_manage_metadata (manage page settings)
# App Review Preparation:
# 1. Complete App Dashboard settings
# 2. Add Privacy Policy URL
# 3. Add Terms of Service URL
# 4. Provide detailed usage instructions
# 5. Record screencast demonstrating bot functionality
# 6. Explain each permission request
# Testing before review:
# - Add testers in App Dashboard
# - Testers can interact with unpublished app
# - Test all functionality thoroughly
# Submit in App Dashboard:
# Settings > App Review > Permissions and Features What You Can Do
Customer Service Automation
Handle common customer inquiries automatically 24/7. Answer FAQs, check order status, process returns, and provide product information. Escalate complex issues to human agents seamlessly. Reduce support costs while improving response times.
E-commerce Assistance
Guide customers through product discovery, answer questions, provide recommendations, and facilitate purchases directly in Messenger. Integrate with Facebook Shops for seamless shopping experiences. Send order confirmations and shipping updates.
Appointment Scheduling
Let customers book appointments, check availability, and manage reservations through conversational AI. Send reminders, handle rescheduling, and reduce no-shows with automated follow-ups. Perfect for service businesses.
Lead Generation
Qualify leads through conversational surveys, collect contact information, and route hot prospects to sales teams. The friendly chat interface increases completion rates compared to traditional forms.
Content Distribution
Deliver personalized content including articles, videos, promotions, and updates. Users subscribe to topics of interest and receive relevant content. Higher engagement than email with instant delivery.
Event Management
Handle event registrations, send confirmations, provide event information, and send reminders. During events, answer attendee questions and facilitate networking. Post-event, gather feedback and share recordings.
Personal AI Assistant
Use OpenClaw through Messenger for personal task management, reminders, information lookup, and daily assistance. The ubiquitous availability of Messenger makes it perfect for always-available AI help.
Restaurant Ordering
Take orders, answer menu questions, handle customizations, and process payments through Messenger. Customers can reorder favorites, check delivery status, and leave reviews - all in chat.
Healthcare Triage
Provide symptom checking, appointment scheduling, medication reminders, and health information. Route urgent cases appropriately while handling routine inquiries automatically. (With proper compliance considerations)
Known Limitations
- 24-hour messaging window: Can only message users who contacted you in the last 24 hours (without paid messaging)
- App Review required: Bots cannot message public users until Meta approves the app
- Message tags: Sending messages outside 24-hour window requires approved message tags
- Template limits: Generic templates limited to 10 elements, buttons limited to 3 per template
- No group messaging: Messenger bots only work in direct conversations, not group chats
- Rate limits: 200 API calls per user per hour, with additional platform-wide limits
- Privacy restrictions: Limited user data access due to privacy policies
- Platform dependency: Subject to Meta's policies which can change with limited notice
- Regional restrictions: Some Messenger features not available in all countries
- Business verification may be required for certain features and higher messaging volumes
- Our team can help you work around these limitations with custom configurations
Related Content
Bring OpenClaw AI Power to Your Discord Server
Deploy OpenClaw as a Discord bot for your server. Automate moderation, answer questions, manage communities, run games, and provide AI assistance to all your members with slash commands and rich embeds.
Supercharge Your Gmail with OpenClaw AI
Connect OpenClaw to Gmail for intelligent email management. Automatically summarize messages, draft responses, organize your inbox, and manage emails through natural language commands.
Connect OpenClaw to LINE Messenger
Deploy OpenClaw on LINE messenger to reach 200 million users across Japan, Taiwan, Thailand, and Indonesia. Build powerful AI chatbots with rich messaging, LIFF apps, and LINE ecosystem integration.
OpenClaw on Matrix: Decentralized AI for a Decentralized World
Deploy OpenClaw on the Matrix protocol for a truly decentralized AI assistant. Self-host everything, federate with others, and maintain complete sovereignty over your AI interactions.