Skip to content
Tellwing

WhatsApp

Send approved WhatsApp templates, such as order updates, reminders and verification codes, from your own number with the Tellwing API, and check whether they were delivered and read. Examples in four languages.
Create a free account

Base URL https://api.tellwing.com/v1 · version 1.0.0

Endpoints

post/whatsappScope: whatsapp:send

Send a transactional WhatsApp message

Sends one approved WhatsApp template of your organization (an order update, an appointment reminder, a verification code) to a phone number or to a subscriber, from your connected WhatsApp number. Only **utility** and **authentication** templates: a marketing template is refused with `422 template_category_not_allowed` (advertising goes as a campaign, where its legal hours and frequency limits apply). Pick the template by `template` (its name) and `language` (required only when the template exists in several languages). `values` fill its variables: `header` (text), `body` (one string per `{{n}}`, in order) and `buttons` (the end of a URL button with a variable, keyed by the button position); for an authentication template, only `code` (at most 15 characters), which WhatsApp shows with its copy button. **Opt-in.** WhatsApp requires that the person agreed to receive messages from your business before you write first. A utility template goes only to a number with WhatsApp permission recorded in your organization: a subscriber whose `channels.whatsapp` is `active` (record it with `channels.whatsapp.consent` in `POST /lists/{id}/subscribers` or `PATCH /subscribers/{id}`); otherwise `422 consent_required`. An authentication template may go to any number, because the person has just asked for the code; then the phone number is not stored. A number that opted out of your WhatsApp messages receives nothing, not even a code (`422 recipient_suppressed`). Status updates (`delivered`, `read`, `failed`) arrive with `GET /whatsapp/{id}` and as the webhook events `whatsapp.delivered`, `whatsapp.read` and `whatsapp.failed`. WhatsApp bills each delivered message to your WhatsApp account, as in campaigns. Limits (`429 rate_limited`): per organization and minute, per number and hour (lower for authentication) and the number of people your WhatsApp number may contact in 24 hours. Only available to organizations with WhatsApp in their plan and a connected number.

Accepts Idempotency-Key.

Request body (application/json)

FieldTypeRequiredDescription
tostringOptionalE.164 (+573001234567) or national number of your organization's country. Send to or contact_id, not both.
contact_idstring (uuid)OptionalA subscriber id: the message goes to their WhatsApp number.
templatestringRequiredThe template name, as in WhatsApp Manager and Templates → WhatsApp.
languagestringOptionalThe template language (es, en_US, pt_BR). Required when the template exists in several languages.
valuesobjectOptionalThe values of the template variables. Without variables, omit it.

Responses

  • 202Accepted by WhatsApp. The delivery and read receipts arrive later.
  • 400`invalid_request` — `param` names the field (`to`, `contact_id`, `template`, `language`, `values`, or the value, such as `values.body.0` or `values.code`); also when WhatsApp rejected the values or the number cannot receive the message. Nothing was sent.
  • 403`channel_not_available` — WhatsApp is not enabled for your organization (it comes with paid plans); `sending_paused` — sending is paused for your organization (while Tellwing reviews its activity, because of its bounce or complaint rate, or until updated legal documents are accepted), nothing was sent; `forbidden_scope` — the key lacks `whatsapp:send`.
  • 404`not_found` — no template with that name (`param: template`) or language (`param: language`), or no subscriber with that `contact_id`.
  • 409`template_not_approved` — the template is pending, rejected, paused or disabled in WhatsApp; `channel_not_available` — no WhatsApp number connected and ready, WhatsApp restricted the account, or WhatsApp is not letting the account start conversations (for example, a payment method or display name pending in WhatsApp Manager; Settings → WhatsApp shows why). Nothing was sent.
  • 422`template_category_not_allowed` — a marketing template (send it as a campaign); `consent_required` — the number or subscriber has no WhatsApp permission recorded in your organization (utility templates); `recipient_suppressed` — the number opted out of your WhatsApp messages. Nothing was sent.
  • 429`rate_limited` — too many WhatsApp messages for your organization in the last minute or to that number in the last hour, your number reached the people it may contact in 24 hours, too many requests, or WhatsApp asked to slow down. Nothing was sent.
  • 502`internal_error` — WhatsApp did not accept the message for an unexpected reason. Nothing was sent.
  • 503`channel_not_available` — WhatsApp is not accepting messages from your account right now for another account reason. Nothing was sent.
curl -X POST "https://api.tellwing.com/v1/whatsapp" \
-H "Authorization: Bearer tw_live_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"template": "…"
}'
get/whatsapp/{id}Scope: whatsapp:send

Get the status of a transactional WhatsApp message

What happened to a message sent with `POST /whatsapp`: `sending`, `sent` (accepted by WhatsApp), `delivered` (on the phone), `read` or `failed` (with `error`). `id` is the `id` of the send or its `message_id`. The values of the variables and the phone number are never stored.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredThe send's id or message_id.

Responses

  • 200The message.
  • 404`not_found` — no WhatsApp message sent through the API with that id in your organization.
curl -X GET "https://api.tellwing.com/v1/whatsapp/8c1f2b3e-4d5a-4f60-9b7c-2e1d3c4b5a69" \
-H "Authorization: Bearer tw_live_…"