> ## Documentation Index
> Fetch the complete documentation index at: https://opensre.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp

> Deliver OpenSRE messages to WhatsApp via Twilio.

## 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](/docs/integrations/messaging/twilio-sms).
</Note>

## Prerequisites

* A Twilio account: [Sign up](https://www.twilio.com/try-twilio)
* Twilio WhatsApp Sandbox (for demos) or a production WhatsApp-enabled sender

## Setup

### Option 1: CLI wizard (recommended)

```bash theme={null}
opensre integrations setup whatsapp
```

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

```bash theme={null}
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

1. Create or open a Twilio account.
2. Enable WhatsApp Sandbox or a production WhatsApp sender.
3. Copy Account SID and Auth Token from the Twilio Console.
4. Set `TWILIO_WHATSAPP_FROM` to your WhatsApp-enabled sender.
5. Set `WHATSAPP_DEFAULT_TO` as 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

```bash theme={null}
opensre integrations verify whatsapp
```

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 `.env` or your secret manager — not in source control.
