Overview
WhatsApp Business API allows you to integrate your AI agent with WhatsApp. This requires a WhatsApp Business account and API access.
Note: WhatsApp Business API is more complex than Telegram or Discord and may require business verification.
Prerequisites
- WhatsApp Business Account
- Facebook Business Manager account
- Verified business (for production use)
- WhatsApp Business API access
Getting WhatsApp Business API Access
There are two main approaches:
Option 1: WhatsApp Cloud API (Recommended)
- Go to Meta for Developers
- Create or select an app
- Add WhatsApp product
- Follow setup wizard
- Get your API credentials
Option 2: Business Solution Provider (BSP)
Work with an official WhatsApp BSP like:
- Twilio
- MessageBird
- 360Dialog
These providers handle infrastructure and provide easier setup.
Configuration in AgentClaw
Add these environment variables based on your provider:
For WhatsApp Cloud API
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id WHATSAPP_ACCESS_TOKEN=your_access_token WHATSAPP_VERIFY_TOKEN=your_verify_token WHATSAPP_BUSINESS_ACCOUNT_ID=your_business_account_idFor Twilio
TWILIO_ACCOUNT_SID=your_account_sid TWILIO_AUTH_TOKEN=your_auth_token TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886Webhook Setup
WhatsApp requires a webhook for receiving messages:
- In WhatsApp Configuration, set webhook URL to:
https://your-instance.agentclaw.app/webhook/whatsapp - Add verify token (matches
WHATSAPP_VERIFY_TOKEN) - Subscribe to
messageswebhook events
Testing
- Save configuration and restart instance
- Send a WhatsApp message to your business number
- Bot should respond via AI
- Check logs for webhook events
Limitations & Pricing
- Message templates: First message to user must use approved template
- 24-hour window: Can send free-form messages within 24h of user message
- Costs: WhatsApp charges per conversation (separate from AgentClaw)
- Verification: Business verification required for production
Next Steps
- Review WhatsApp Business API docs
- Learn about Telegram integration (simpler alternative)
- Read about managing API keys