The WhatsApp channel allows your Corvus agent to interact with users via WhatsApp Business using Meta’s Cloud API. Unlike polling-based channels (Telegram, Discord), WhatsApp uses webhooks for push-based message delivery.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dallay/corvus/llms.txt
Use this file to discover all available pages before exploring further.
Features
- Webhook-based message delivery (push, not poll)
- E.164 phone number allowlist
- Meta Business Cloud API integration
- Text message support (images/media coming soon)
- Webhook verification
- Automatic phone number normalization
Prerequisites
- Meta (Facebook) Developer Account
- WhatsApp Business App in Meta Developer Console
- Public HTTPS endpoint (ngrok, Cloudflare Tunnel, or Tailscale Funnel)
WhatsApp Business Cloud API Setup
1. Create a Meta Business App
- Go to Meta for Developers
- Click My Apps → Create App
- Select app type: Business
- Enter app name (e.g., “Corvus WhatsApp Bot”)
- Enter contact email
- Click Create App
2. Add WhatsApp Product
- In your app dashboard, click Add Product
- Find WhatsApp and click Set Up
- You’ll be redirected to WhatsApp → Getting Started
3. Get Required Credentials
You need three pieces of information:Access Token
- Navigate to WhatsApp → API Setup
- Under Temporary access token, click Generate token
- Copy the token (starts with
EAA...):
- Business Settings → System Users → Add → Generate token with
whatsapp_business_messagingpermission
Phone Number ID
- In WhatsApp → API Setup, locate Phone number ID
- Copy the numeric ID:
Verify Token
You define this yourself (any random string):3f7a9b2c8d1e6f4a7b9c8d1e6f4a7b9c
4. Configure Corvus
Add WhatsApp configuration to~/.corvus/config.toml:
Configuration Options
| Field | Type | Required | Description |
|---|---|---|---|
access_token | String | Yes | Meta access token (temporary or system user token) |
phone_number_id | String | Yes | WhatsApp phone number ID from API Setup |
verify_token | String | Yes | Your custom verify token for webhook verification |
allowed_numbers | Array | Yes | List of allowed phone numbers in E.164 format |
5. Expose Public HTTPS Endpoint
WhatsApp requires HTTPS for webhooks. Use a tunnel: Option A: ngrokhttps://abc123.ngrok.io).
6. Configure Meta Webhook
- In Meta Developer Console, navigate to WhatsApp → Configuration → Webhook
- Click Edit
- Enter webhook details:
- Callback URL:
https://your-public-url/whatsapp - Verify Token: (the token you defined in step 3)
- Callback URL:
- Click Verify and Save
hub.challenge value to complete verification.
- Subscribe to Webhook Fields:
- Click Manage button
- Subscribe to: ✅ messages
- Click Save
7. Start Corvus
Start the agent runtime with gateway:8. Test
- Send a WhatsApp message to your Business phone number
- If your number is in
allowed_numbers, the bot responds via the LLM - Check Corvus logs:
Phone Number Allowlist (E.164 Format)
E.164 Format
Phone numbers must be in E.164 international format:- US:
+1234567890 - UK:
+447700900000 - India:
+919876543210
- ❌
1234567890(missing+) - ❌
(123) 456-7890(formatting) - ❌
+1 234 567 890(spaces)
Configuration
Wildcard (Allow All)
Not recommended for production:Empty Allowlist
An empty allowlist denies everyone:Webhook Verification
When you configure the webhook in Meta Developer Console, Meta sends a verification request:src/gateway/mod.rs) handles this:
- Checks
hub.verify_tokenmatches your configuredverify_token - Responds with
hub.challengevalue - Meta marks webhook as verified
- Check
verify_tokenmatches exactly (case-sensitive) - Ensure Corvus gateway is running
- Check tunnel is forwarding to correct port
Webhook Payload
Meta sends POST requests to/whatsapp with this structure:
from: Phone number (normalized to E.164)text.body: Message contenttimestamp: Unix timestamp
Testing and Verification
1. Health Check
Verify WhatsApp API connectivity:2. Send Test Message
- Send a WhatsApp message to your Business phone number from an allowlisted number
- Check Corvus logs for processing:
3. Unauthorized Number Test
Send from a number NOT inallowed_numbers:
Corvus logs:
Message Types
Currently Supported
- ✅ Text messages - Full support
Coming Soon
- ⏳ Images - Receiving/sending images
- ⏳ Audio - Voice messages
- ⏳ Video - Video messages
- ⏳ Documents - PDF, DOCX, etc.
- ⏳ Location - GPS coordinates
- ⏳ Contacts - Contact card sharing
Troubleshooting
Webhook Verification Failed
Error in Meta Console:verify_tokenmismatch (case-sensitive)- Corvus gateway not running
- Tunnel not forwarding to correct port
- HTTPS required (not HTTP)
Messages Not Received
1. Check Webhook Subscription: Meta Developer Console → WhatsApp → Configuration → Webhook → Manage:- ✅ messages field must be subscribed
- Webhook not reaching Corvus
- Check tunnel is active
- Verify callback URL in Meta console
Bot Not Sending Reply
Corvus logs:allowed_numbers.
Access Token Expired
Error:- Meta Developer Console → Business Settings → System Users
- Create System User
- Assign WhatsApp Business Account asset
- Generate token with
whatsapp_business_messagingpermission - Update
access_tokeninconfig.toml
Rate Limits
Meta enforces rate limits based on your Business account tier:- Free tier: 1,000 conversations per month
- Paid tier: Higher limits based on billing
Security Best Practices
- Use E.164 Format: Always validate phone numbers
- Empty Allowlist by Default: Explicitly add each authorized number
- System User Tokens: Use long-lived tokens for production (not temporary tokens)
- Keep Tokens Secret: Never commit access tokens to version control
- Webhook Signature Verification: Enable Meta signature verification (coming soon)
- Monitor Usage: Track conversations in Meta Business Manager
- HTTPS Only: Always use secure tunnels for webhooks
Gateway Endpoints
Corvus gateway exposes these endpoints for WhatsApp:| Endpoint | Method | Purpose | Parameters |
|---|---|---|---|
/whatsapp | GET | Webhook verification | hub.mode, hub.verify_token, hub.challenge |
/whatsapp | POST | Incoming message webhook | JSON payload from Meta |
Reference
- Source:
clients/agent-runtime/src/channels/whatsapp.rs - Gateway handler:
clients/agent-runtime/src/gateway/mod.rs - Meta Cloud API: https://developers.facebook.com/docs/whatsapp/cloud-api
- E.164 Format: https://en.wikipedia.org/wiki/E.164
- Meta Business Manager: https://business.facebook.com/
- README:
clients/agent-runtime/README.md:239-276 - Line range:
whatsapp.rs:1-1115