๐Ÿ”—Integration & Channels

How to Connect OpenClaw to WhatsApp

Advanced2-4 hoursUpdated 2025-01-22

Connecting OpenClaw to WhatsApp requires navigating Meta's WhatsApp Business API, which involves business account verification, webhook configuration, and template message approval. This advanced guide walks you through every step of the integration process, from Meta Business account creation to handling media and rich messages.

Why This Is Hard to Do Yourself

These are the common pitfalls that trip people up.

๐Ÿ“‹

Business API complexity

WhatsApp requires a Meta Business account, app creation, phone number verification, and webhook setup before sending a single message

๐Ÿ”

Webhook verification

WhatsApp uses a challenge-response verification flow that must be handled correctly or your webhook never receives messages

๐Ÿ“

Template requirements

You can't send proactive messages without pre-approved templates. Template approval takes 24-48 hours.

โฑ๏ธ

24-hour messaging window

After 24 hours of inactivity, you can only send template messages, not free-form responses

Step-by-Step Guide

Step 1

Create a Meta Business account

Register at business.facebook.com. Get a verified business account.

Step 2

Create a WhatsApp Business App

# 1. Go to developers.facebook.com
# 2. Create a new App โ†’ select "Business" type
# 3. Add "WhatsApp" product to your app
# 4. Note your Phone Number ID and Access Token
Step 3

Set up the webhook endpoint

# In OpenClaw config/channels/whatsapp.yaml:
whatsapp:
  enabled: true
  phone_number_id: "YOUR_PHONE_NUMBER_ID"
  access_token: "YOUR_PERMANENT_ACCESS_TOKEN"
  verify_token: "your-custom-verify-string"
  webhook_path: "/webhooks/whatsapp"

Warning: The access token from the Meta dashboard is temporary (24 hours). Generate a permanent System User access token for production use.

Step 4

Configure webhook verification

# OpenClaw handles verification automatically when configured.
# Register your webhook URL in Meta Developer Portal:
# Callback URL: https://your-domain.com/webhooks/whatsapp
# Verify Token: your-custom-verify-string (must match config)
# Subscribe to: messages, messaging_postbacks
Step 5

Create message templates

# Templates must be approved by Meta before use.
# Create in WhatsApp Manager โ†’ Message Templates
# Example template:
# Name: welcome_message
# Category: Marketing
# Body: "Hi {{1}}, thanks for reaching out! How can I help?"
# Submit for review (24-48 hours)
Step 6

Test the integration

# Send a test message from your WhatsApp to the registered number.
# Check OpenClaw logs:
tail -f ~/.openclaw/logs/channels.log | grep whatsapp

# You should see incoming message events
Step 7

Handle media and rich messages

# In config/channels/whatsapp.yaml (continued):
media:
  enabled: true
  max_file_size_mb: 16
  supported_types:
    - image/jpeg
    - image/png
    - application/pdf
    - audio/ogg

WhatsApp Setup Is a Full Project

Meta Business verification, webhook configuration, template approval, and the 24-hour messaging window โ€” our integration experts handle all of it. Most WhatsApp integrations are live within a day.

Get matched with a specialist who can help.

Sign Up for Expert Help โ†’

Frequently Asked Questions