Send & receive WhatsApp
Send WhatsApp messages from a number you connect by scanning a QR code — no templates, no business verification. Once connected, drive it from the API for OTPs, order updates and receipts, and receive replies, delivery and read receipts on your own webhook.
- Connect a number
- Channel settings
- Request parameters
- Sample request
- Response
- Rate limits
- Receiving messages
- Delivery & read receipts
- Group chats
- Error responses
Every WhatsApp message, on either of your numbers, is sent through one endpoint:
POST /api/v1/whatsapp/messages. This page covers the number you link by QR code; put
"channel": "qr" in the body to send on it. Also connected through Meta's official WhatsApp
Business Platform? The same endpoint sends there with "channel": "meta" — see
Official API & routing.
Connect a number
WhatsApp is enabled per project. In the dashboard open Project → WhatsApp and click Request WhatsApp. Once our team provisions your channel you'll get an email; return to that page, scan the QR code with WhatsApp (Settings → Linked devices → Link a device), and the number is live for sending and receiving. One number per project.
Your number stays linked until you unlink it in the phone's Linked devices screen,
or you tap Reset in the dashboard. A brief network drop only makes the channel
reconnecting — it does not unlink you, and it does not need a new QR scan. Sends during that
window return 503 channel_reconnecting, which is safe to retry.
A connected number may carry a monthly fee, on top of the per-message price. When it does,
the WhatsApp page shows it before you connect, along with the free trial that comes first, and what is
paid. We email you when the trial starts, halfway through it, and before it ends. The fee is taken from
your project balance (postpay accounts: added to the invoice). If a month
cannot be taken, sending from the number pauses — sends return 402 channel_fee_unpaid — and
resumes by itself within the hour of a top-up, or straight away with Pay now on that page.
Messages sent to the number are still received while it is paused.
Channel settings
Project → WhatsApp carries three switches, each off by default:
| Setting | What it does |
|---|---|
| Inbound webhook URL | Where we POST messages your number receives. You can add or change it at any time, not just when requesting the channel. |
| Send read receipts | Marks inbound messages as read (blue ticks) once we've accepted them. Off means senders see one grey tick, exactly as if nobody had opened the chat. |
| Receive group messages | Off by default. On, every message in the groups your number is in reaches your inbox and your webhook. Off, group messages are not collected. See Group chats. |
| Reply when mentioned | Off by default, and needs Receive group messages. Lets your automations answer a group message that @mentions your number. Leave it off to collect group messages without replying. |
Request parameters
Send to POST /api/v1/whatsapp/messages. With "channel": "qr" the message goes out on
the number you linked by QR code. Leave channel out and Sozuri chooses (see
how a channel is chosen); with only a QR number linked, that
is this number anyway. The answer always says which channel carried the message. The older
/api/v1/messaging/whatsapp is deprecated: its answers carry a Deprecation header.
It is retired after 31 January 2027, when it starts answering
410 Gone: move to POST /api/v1/whatsapp/messages before then.
The request body is JSON. Provide project, channel and to plus exactly one content field. text doubles as the caption for image, video and document. Media is sent by public URL — there is no upload step.
| Field | Required | Type | Description |
|---|---|---|---|
| project | Yes | String | The Sozuri project name that owns the API key making this request. Required on every request — the key and project name together authenticate the call. |
| channel | Recommended | String | qr sends on the number you linked by QR code. Leave it out to let Sozuri choose; anything other than qr or meta is refused with 422 invalid_channel. |
| to | Yes | String | Recipient in E.164 (2547XXXXXXXX), a full JID (2547...@s.whatsapp.net), or a group JID (1234...@g.us). |
| text | One of | String | Message text, or the caption for a media message. |
| imageUrl | One of | URL | Public URL of an image (with optional text caption). |
| videoUrl | One of | URL | Public URL of a video (with optional text caption). |
| audioUrl | One of | URL | Public URL of an audio file. Add "voice": true for a voice note. |
| documentUrl | One of | URL | Public URL of a document. Optional documentFilename and text. |
| stickerUrl | One of | URL | Public URL of a .webp sticker. |
| location | One of | Object | { latitude, longitude, name?, address? } — latitude and longitude must be JSON numbers, not strings. |
| contact | One of | Object | { fullName, phone, organization? } |
| reaction | One of | Object | { messageId, emoji }: react to a message in this chat. An empty emoji ("") removes your reaction, so emoji must always be present. |
| replyTo | No | String | Make this message a reply: the id of a message in this chat, which WhatsApp shows quoted above yours. Not with reaction. |
| mentions | No | Array | JIDs to @mention, e.g. ["254700000000@s.whatsapp.net"]. Only meaningful when to is a group; write the display @254700000000 into text yourself. |
Send an Idempotency-Key header (a new UUID per message) and a retry
after a timeout is answered with the first response instead of sending again.
Sample request
Required headers
POST /api/v1/whatsapp/messages
Content-Type: application/json
Authorization: Bearer Your_Project_API_KEY
Text (e.g. an OTP)
curl -X POST https://sozuri.net/api/v1/whatsapp/messages \
-H "Authorization: Bearer $SOZURI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "project": "your_project_name", "channel": "qr", "to": "254700000000", "text": "Your OTP is 123456" }'
Image with a caption
curl -X POST https://sozuri.net/api/v1/whatsapp/messages \
-H "Authorization: Bearer $SOZURI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "project": "your_project_name", "channel": "qr", "to": "254700000000", "imageUrl": "https://example.com/receipt.png", "text": "Your receipt" }'
Reply to a message, and react to one
curl -X POST https://sozuri.net/api/v1/whatsapp/messages \
-H "Authorization: Bearer $SOZURI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "project": "your_project_name", "channel": "qr", "to": "254700000000", "text": "Yes, 4 left in stock", "replyTo": "3EB0C431C26A1916E0D3" }'
curl -X POST https://sozuri.net/api/v1/whatsapp/messages \
-H "Authorization: Bearer $SOZURI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "project": "your_project_name", "channel": "qr", "to": "254700000000", "reaction": { "messageId": "3EB0C431C26A1916E0D3", "emoji": "👍" } }'
The id is a message.id from a message you received, or the message.id you got back
when you sent one. It must belong to the chat you are writing to; any other id is refused with
422 message_not_found and nothing is sent or charged. A reaction is billed as one message.
Response
200 OK — the same shape for every message type:
{
"status": "accepted",
"channel": "qr",
"routed": "channel",
"message": {
"id": "BAE5F...",
"to": "254700000000",
"type": "text",
"status": "sent"
}
}
message.id is WhatsApp's own id. Keep it — it is the key that
delivery and read receipts arrive under. channel is the channel that
carried the message and routed says why it was chosen: channel when you named it,
otherwise one of the reasons listed under how a channel is chosen.
Rate limits
Sends are limited per project, and the limit applies to your API key however many
servers you call from. Exceeding it returns 429 rate_limited with a
Retry-After header; wait that many seconds and retry. Your official number has its own,
separate allowance.
The channel is built for conversational and transactional traffic — OTPs, order updates, receipts, support replies. It is not a broadcast channel. Unsolicited bulk messaging from a QR-linked number is the fastest way to have that number banned by WhatsApp, and a ban is not something we or you can appeal. The current limit is shown on Project → WhatsApp; talk to us before designing anything that needs a higher one.
Receiving messages
Set an inbound webhook URL on Project → WhatsApp. Each message your number receives is POSTed to that URL:
{
"event": "message.received",
"channel": "qr",
"from": "254700000000",
"to": "254711000000",
"chatId": "254700000000@s.whatsapp.net",
"profileName": "Amina",
"message": { "id": "ABC", "type": "text", "text": "hi", "fromMe": false, "replyTo": "3EB0C431C26A1916E0D3" },
"timestamp": "2026-07-19T10:30:00.000Z"
}
to is your WhatsApp number the message came to, and profileName the sender's
WhatsApp name; both are left out when not known. message.replyTo appears only when the
sender replied to (quoted) one of the messages in the chat, and holds that message's id.
channel is "qr" here and "meta" on your
official WhatsApp number, whose webhook has the same fields in the
same order, so one handler can read both. These four fields were added on 8 November 2026.
from is the sender's number where WhatsApp gives us one. WhatsApp increasingly
addresses chats by a privacy id instead, so from can be a
...@lid JID — still a valid address to reply to, but not a phone
number, so don't store it in a phone-number column.
Media (image/video/audio/document/sticker) arrives with a media object carrying a
download url and the caption in message.text. A file too large to store
arrives as metadata with "truncated": true and no url.
A shared location arrives as "type": "location" with a location
object, and a shared contact card as "type": "contacts" with a
contacts list. Both also describe themselves in message.text, so a receiver that
only reads text still sees something useful. A reaction to one of your messages arrives
as "type": "reaction" with a reaction object (an empty emoji means
it was removed). No other message carries these objects. Automated replies never answer a reaction.
"message": { "id": "LOC1", "type": "location", "text": "Location: Duka, Moi Ave (-1.2921, 36.8219)", "fromMe": false },
"location": { "latitude": -1.2921, "longitude": 36.8219, "name": "Duka", "address": "Moi Ave" }
"message": { "id": "CON1", "type": "contacts", "text": "Contact: Amina Otieno 254722000111", "fromMe": false },
"contacts": [ { "fullName": "Amina Otieno", "phone": "254722000111" } ]
"message": { "id": "R1", "type": "reaction", "text": "👍", "fromMe": false },
"reaction": { "messageId": "3EB0C431C26A1916E0D3", "emoji": "👍" }
name and address appear only when the pin has them, and a live location adds
"live": true. A contact's phone is their WhatsApp number when the card carries one.
Every request is signed with the same scheme as your delivery callbacks:
X-Sozuri-Signature: t=<unix>,v1=<hmac>, where the HMAC is
hmac_sha256(signing_secret, "<t>.<raw body>"). Hash the raw
body before parsing it as JSON, take your secret from
Manage API → Callback URLs → Webhook security, and respond
2xx quickly — the reply is not read.
To mark a received message read, and show the customer you are typing, call
POST /api/v1/whatsapp/messages/{id}/read with message.id and "typing": true.
It is the same endpoint on both channels: see Mark a message read.
Delivery & read receipts
WhatsApp reports what happened to each message you sent. Those receipts always update the dashboard and the chat inbox. To have them POSTed to your inbound webhook URL as well, tick Also send delivery statuses to this webhook under Channel settings on the WhatsApp page. It is off by default, so a receiver written for messages never starts getting an event it did not ask for. Status webhooks are not switched on at Sozuri yet: the setting is saved and takes effect when they are. They will then arrive signed identically, like this:
{
"event": "message.status",
"messageId": "BAE5F...",
"status": "read",
"to": "254700000000",
"timestamp": "2026-07-19T10:30:04.000Z"
}
status | Meaning |
|---|---|
sent | WhatsApp accepted the message from us. |
delivered | It reached the recipient's device (two grey ticks). |
read | The recipient opened it (blue ticks). Only if they have read receipts on. |
failed | WhatsApp could not deliver it. |
Status only ever moves forward: pending → sent → delivered →
read. Receipts can arrive out of order, and a late delivered after a
read is discarded rather than moving the message backwards — so you can apply each
event as you get it. read is not guaranteed: many people turn read receipts off, and
those messages simply stop at delivered. Treat delivered, not
read, as your success signal.
Group chats
Turn on Receive group messages on Project → WhatsApp (off by
default) and every message in the groups your number is in reaches your webhook and your inbox.
group.mentionedUs tells you whether it @mentions your number.
Busy groups send a lot of messages, so make sure your webhook can take the volume, and check
group before you answer anything automatically.
Sozuri's own automations (the AI agent, keyword rules and workflows) answer a group message only when it mentions your number and you have also turned on Reply when mentioned (off by default). With it off you collect group messages and nothing is ever sent. Nothing else said in a group is ever answered: a bot that replies to every group message is the behaviour that gets numbers banned.
A group message adds a group object and points chatId at the group:
{
"event": "message.received",
"channel": "qr",
"from": "254700000000",
"to": "254711000000",
"chatId": "120363000000000000@g.us",
"group": {
"id": "120363000000000000@g.us",
"subject": "Ops team",
"participant": "254700000000@s.whatsapp.net",
"mentionedUs": true
},
"message": { "id": "ABC", "type": "text", "text": "@254711000000 what is the ETA?", "fromMe": false },
"timestamp": "2026-07-19T10:30:00.000Z"
}
from / group.participant is who spoke; chatId is where the
answer belongs. To reply into the group, send to the group JID and pass
mentions if you want to tag someone:
curl -X POST https://sozuri.net/api/v1/whatsapp/messages \
-H "Authorization: Bearer $SOZURI_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "project": "your_project_name",
"channel": "qr",
"to": "120363000000000000@g.us",
"text": "@254700000000 ETA is 14:30",
"mentions": ["254700000000@s.whatsapp.net"] }'
Billing: a group message that mentions you is billed as one inbound message; one that doesn't is delivered to you but never billed. A reply to a group is billed as one outbound message no matter how many people are in the group.
Error responses
| HTTP | code | When |
|---|---|---|
| 401 | AUTHENTICATION_FAILED | Missing or invalid API key, or a project name that does not go with it. |
| 422 | VALIDATION_FAILED | to is missing, or a field is too long; errors names each field. |
| 422 | invalid_message | Nothing to send, more than one content field, or a reaction without its messageId or its emoji. errors names the field. |
| 422 | invalid_channel | channel is something other than qr or meta. |
| 422 | address_not_on_channel | to is a WhatsApp user id (KE.…), which only the official channel can reach, and you asked for qr. Send to the phone number, or leave channel out and it is routed to your official number. |
| 422 | unsupported_on_qr | That kind of message (a template, buttons, a list) exists on the official channel only. |
| 422 | invalid_recipient | to is a WhatsApp Channel or broadcast address (…@newsletter, …@broadcast), which cannot receive messages. Send to a phone number or a group. |
| 422 | message_not_found | replyTo or reaction.messageId is not the id of a message in this chat. Nothing was sent. |
| 422 | recipient_opted_out | This person is on your Do-Not-Disturb list for WhatsApp messages from this number (the Ban Number screen, or they asked your AI agent to stop). Nothing was sent or charged. They can still get a reply when they write to you. A ban on SMS or voice calls does not stop WhatsApp. |
| 402 | insufficient_balance | Not enough balance to cover the message. Top up and retry. |
| 402 | channel_fee_unpaid | The number's monthly fee could not be taken, so sending is paused. Top up; it resumes within the hour, or press Pay now on the WhatsApp page. Nothing was sent. |
| 409 | channel_unavailable | No QR number is linked to this project — scan the QR code in the dashboard. |
| 409 | not_connected | You left channel out and the project has no WhatsApp number connected on either channel. |
| 409 | from_not_found | from is not one of this project's connected WhatsApp numbers. |
| 409 | rate_not_configured | No WhatsApp price is set on your account. Contact support — retrying won't clear it. |
| 429 | rate_limited | Send rate exceeded. Retry after the seconds given in Retry-After. |
| 429 | spend_limit_reached | The message would go over one of your project's spending limits (WhatsApp messages a day, daily spend, or the monthly budget), set under Billing → Spending limits. Nothing was sent or charged. The message says which limit, how much is used and when it resets: daily limits at midnight East Africa Time, the monthly budget on the 1st. |
| 502 | processing_error | The WhatsApp gateway was unreachable or errored. |
| 503 | channel_reconnecting | Your number is still linked but the connection is re-establishing. Retry in a few seconds. |
Errors carry the code in the body as well as the HTTP status, and the channel when one was chosen:
{
"error": {
"code": "channel_reconnecting",
"message": "The WhatsApp connection is re-establishing. Your number is still linked — retry in a few seconds.",
"status": 503,
"channel": "qr"
}
}
The two upper-case codes, AUTHENTICATION_FAILED and VALIDATION_FAILED, are answered
before the message is read, in the platform-wide shape every Sozuri API shares:
{ "error_code": "VALIDATION_FAILED", "message": "…", "retryable": false, "errors": { … } }.