- Twilio — Managed webhook + REST API. Paid. Production-ready. No QR login.
- Baileys — Self-hosted via Node.js sidecar. Free. Full protocol access (polls, reactions, groups, QR login).
Quick Start (Baileys)
The fastest way to get a WhatsApp agent running — no API keys, no webhooks, just scan a QR code.auth_dir and subsequent runs connect automatically.
Baileys requires Node.js >= 18 on the host. The bridge dependencies (
@whiskeysockets/baileys, ws) are auto-installed on first run via npm install.Quick Start (Twilio)
For production deployments using the Twilio WhatsApp Business API.http://your-server:8000/whatsapp/webhook.
Provider Comparison
| Feature | Twilio | Baileys |
|---|---|---|
| Setup | API keys + webhook | QR code scan |
| Cost | Paid (per message) | Free |
| Media | URL-based only | Full (bytes + URL) |
| Polls | No | Yes |
| Reactions | No | Yes |
| Groups | No | Yes |
| QR Login | No | Yes |
| Typing indicator | No | Yes |
| Hosting | Managed (webhook) | Self-hosted (sidecar) |
WhatsAppInterface Parameters
Provider Selection
Transport provider:
"twilio" or "baileys".Twilio Parameters
Twilio account SID. Required when
provider="twilio".Twilio auth token. Used for REST API calls and webhook signature validation.
WhatsApp sender number (format:
whatsapp:+14155238886). Required for Twilio.Validate
X-Twilio-Signature on incoming webhooks. Disable only for local testing.Baileys Parameters
Directory for WhatsApp credential storage. Created automatically.
Path to the Node.js binary. Override if
node is not on your PATH.WebSocket port for the sidecar.
0 = auto-assign (recommended).Maximum reconnect attempts before giving up after a disconnect.
Heartbeat interval for the sidecar connection.
Shared Parameters
Sender access control policy. See Access Control below.
Convert Markdown formatting in agent responses to WhatsApp-compatible formatting (
**bold** to *bold*, etc.).Maximum characters per message. Long responses are split at word boundaries.
URL path for the Twilio webhook endpoint.
Enable verbose logging in both Python and the Node.js sidecar.
Access Control
UseWhatsAppPolicy to control which messages reach the agent.
Policy Options
Direct message policy:
"allowlist" (only allow_from), "open" (all DMs), or "disabled" (block all DMs).Allowed sender phone numbers in E.164 format. Use
"*" for wildcard.Group message policy:
"open", "allowlist", or "disabled".Separate allowlist for group senders. Falls back to
allow_from if not set.Your own phone number (E.164). Used for self-chat detection.
Media Support
Both providers handle media, but with different capabilities:| Media Type | Twilio | Baileys |
|---|---|---|
| Images | URL only | URL + bytes |
| Audio | URL only | URL + bytes |
| Video | URL only | URL + bytes |
| Files | URL only | URL + bytes |
Image, Audio, Video, and File types and passed to the agent.
Voice Notes
WhatsApp voice notes work withaudio_transcriber=True:
Sending Media
Agents can send media back via tool responses:Markdown Conversion
Whenmarkdown_conversion=True (default), agent responses are automatically converted to WhatsApp-compatible formatting:
| Markdown | |
|---|---|
**bold** | *bold* |
*italic* | _italic_ |
~~strike~~ | ~strike~ |
`code` | ```code``` |
# Heading | *Heading* |
[text](url) | text (url) |
Baileys Features
QR Login
The Baileys provider supports programmatic QR login:Polls
Reactions
Health Check
Phone Number Normalization
Phone numbers are automatically normalized to bare E.164 (digits only, no+):