Overview¶
OpenSRE's WhatsApp integration delivers messages to any WhatsApp number via Twilio's Messaging API. Delivery-only — no gateway or pairing.
Note
This integration uses Twilio as the WhatsApp provider. SMS is a separate integration — see Twilio SMS.
Prerequisites¶
- A Twilio account: Sign up
- Twilio WhatsApp Sandbox (for demos) or a production WhatsApp-enabled sender
Setup¶
Option 1: CLI wizard (recommended)¶
You'll be prompted for:
- Twilio Account SID (starts with
AC...) - Twilio Auth Token
- Twilio WhatsApp From number (for example
whatsapp:+14155238886) - Default recipient phone number (optional)
WhatsApp is configured separately from first-run onboarding — use this setup command.
Option 2: Environment variables¶
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_WHATSAPP_FROM=whatsapp:+14155238886
WHATSAPP_DEFAULT_TO=+1234567890
| Variable | Description |
|---|---|
TWILIO_ACCOUNT_SID |
Twilio account SID (shared with SMS) |
TWILIO_AUTH_TOKEN |
Twilio auth token (shared with SMS) |
TWILIO_WHATSAPP_FROM |
WhatsApp sender (auto-prefixed whatsapp: if needed) |
WHATSAPP_DEFAULT_TO |
Default recipient (international format) |
Credentials¶
- Create or open a Twilio account.
- Enable WhatsApp Sandbox or a production WhatsApp sender.
- Copy Account SID and Auth Token from the Twilio Console.
- Set
TWILIO_WHATSAPP_FROMto your WhatsApp-enabled sender. - Set
WHATSAPP_DEFAULT_TOas the default recipient.
From/to numbers are auto-prefixed with whatsapp: in delivery. No WhatsApp-specific agent tools are registered — this is a delivery channel only. Long messages are truncated to WhatsApp limits.
Verify¶
This calls the Twilio Account API to verify the credentials. It does not prove WhatsApp sender readiness for a specific destination.
Troubleshooting¶
| Symptom | Fix |
|---|---|
Missing account_sid |
Set TWILIO_ACCOUNT_SID |
Missing auth_token |
Set TWILIO_AUTH_TOKEN |
Twilio API check failed: 401 |
The SID/token pair is invalid |
| Messages never arrive but verify passes | Confirm TWILIO_WHATSAPP_FROM is a valid WhatsApp sender; recipient in international format; for sandbox, join from the destination WhatsApp number |
Security¶
- Treat Twilio auth tokens like passwords.
- Prefer a dedicated Twilio project for OpenSRE.
- Store credentials in
.envor your secret manager — not in source control.
Markdown source: View on AtomGit·Content from the open-source project op/opensre