WhatsApp Connect
Send from your own WhatsApp numbers linked by QR code: single, media and bulk messages.
WhatsApp Connect is a plugin that sends messages from your own WhatsApp numbers, linked by scanning a QR code — like WhatsApp Web. There are no templates to approve: send any text, personalised per recipient, with an optional image, video or document. Messages are reported through the same statuses and webhooks as SMS, and messages people send back arrive in your dashboard inbox, the API and message.received webhooks.
Unofficial protocol — use it responsibly
Set up
- In the dashboard, open Plugins and activate WhatsApp Connect (company owners and admins). Pick a subscription plan if SMS21 offers one; otherwise each message is charged from your wallet.
- Open WhatsApp Connect → Devices, add a device and scan its QR code with WhatsApp on your phone (Settings → Linked devices → Link a device). The device shows
connectedwithin a few seconds. Keep the phone online occasionally, or WhatsApp unlinks it after about 14 days. - Create an API key with the
whatsapp_connect:sendscope under API keys. Test keys never use a device, so you can build against them first.
Send a message
POST /whatsapp-connect/send queues one message and returns 202 with the message. A connected device sends it at its own pace.
| Field | Type | Description | |
|---|---|---|---|
to | string | required | Recipient in international format, e.g. 919876543210. |
text | string | required | Up to 4096 characters (1024 as a media caption). Personalise with {{name}}, or {{name|fallback}} for a default. |
variables | object | optional | Values for the placeholders, by name. |
media | object | optional | { type, url, filename? } — see Media. |
deviceId | string | optional | Send from this device (wad_…). Omit to rotate across connected devices. |
type | string | optional | transactional (default) or promotional — the pricing category. |
curl -X POST https://sms21.in/v1/whatsapp-connect/send \
-H "X-API-Key: $SMS21_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: order-A1042-shipped" \
-d '{"to":"919876543210","text":"Hi {{name|there}}, order {{order}} has shipped.","variables":{"name":"Asha","order":"A-1042"}}'Media
Add media to send a file, with text as its caption. SMS21 downloads it from a public https URL (no redirects) when the message is sent.
| type | Accepted files |
|---|---|
image | JPEG, PNG or WebP |
video | MP4 or 3GPP |
document | Any file except HTML; set filename to the name the recipient sees. |
curl -X POST https://sms21.in/v1/whatsapp-connect/send \
-H "X-API-Key: $SMS21_API_KEY" -H "Content-Type: application/json" \
-d '{"to":"919876543210","text":"Your invoice is attached.","media":{"type":"document","url":"https://cdn.example.com/INV-1042.pdf","filename":"Invoice-1042.pdf"}}'Send to a WhatsApp group
Your linked numbers can post to the WhatsApp groups they are in. GET /whatsapp-connect/groups lists them (filter with deviceId or search); pass a group's groupId to POST /whatsapp-connect/send instead of to. Text, placeholders and media work as for a number.
| Rule | What happens |
|---|---|
| Who sends | A linked number that is in the group, preferring one that is online. Pin one with deviceId if several of your numbers are in the group. |
| Admin-only groups | When only admins may post (onlyAdminsCanSend), the number must be an admin; otherwise the send is refused with 400. |
| Group list | Refreshed a few seconds after a device connects and whenever groups change (joined, left, renamed, promoted). |
| Left the group later | A queued message ends as rejected with NOT_IN_GROUP (not charged). |
| Price | One message, priced at the sending number’s country. |
# 1. Find the group
curl https://sms21.in/v1/whatsapp-connect/groups?search=sales -H "X-API-Key: $SMS21_API_KEY"
# {"success":true,"data":[{"groupId":"120363025246125486@g.us","name":"Sales team",
# "deviceId":"wad_…","participants":42,"onlyAdminsCanSend":false,"canSend":true,…}]}
# 2. Send to it
curl -X POST https://sms21.in/v1/whatsapp-connect/send \
-H "X-API-Key: $SMS21_API_KEY" -H "Content-Type: application/json" \
-d '{"groupId":"120363025246125486@g.us","text":"Team, the October report is ready."}'Groups and WhatsApp's rules
Bulk campaigns
POST /whatsapp-connect/bulk queues a campaign (202). Send exactly one of recipients (up to 5 000, each with its own variables) or listId (a saved contact list whose columns fill the placeholders). Every recipient’s text is checked up front, so a missing value fails the request instead of sending a broken message.
| Field | Type | Description | |
|---|---|---|---|
text | string | required | The message, with placeholders. |
recipients | array | optional | [{ to, variables? }] — duplicates are collapsed. |
listId | string | optional | A contact list (lst_…). |
name | string | optional | Label shown in reports. |
media | object | optional | Same as for a single message. |
deviceId | string | optional | Pin the campaign to one device; omit to spread it over all. |
scheduledAt | string | optional | ISO 8601 send time; omit to start now. |
type | string | optional | promotional (default) or transactional. |
curl -X POST https://sms21.in/v1/whatsapp-connect/bulk \
-H "X-API-Key: $SMS21_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: festive-offer-2026" \
-d '{
"name": "Festive offer",
"text": "Hi {{name|there}}, enjoy 20% off this week.",
"media": {"type": "image", "url": "https://cdn.example.com/offer.jpg"},
"recipients": [
{"to": "919876543210", "variables": {"name": "Asha"}},
{"to": "919812345678"}
]
}'| Endpoint | Purpose |
|---|---|
GET /whatsapp-connect/bulk | List campaigns, newest first. |
GET /whatsapp-connect/bulk/{batchId} | Progress counts. |
GET /whatsapp-connect/bulk/{batchId}/recipients | The message created for each recipient, or why it was skipped (suppressed or blocked numbers). |
POST /whatsapp-connect/bulk/{batchId}/cancel | Stops recipients not yet created; messages already queued are still sent. |
Devices and pacing
GET /whatsapp-connect/devices lists your linked numbers with status (connected, qr_pending, disconnected or logged_out), sentToday and dailyLimit — useful for a health check before a campaign. Devices are linked, paused and removed only in the dashboard, because linking needs a phone.
- Each device waits
sendIntervalSeconds(plus random jitter) between messages and stops at itsdailyLimit; both are set per device in the dashboard. Slow, human-like sending protects your number. - Without
deviceId, messages rotate across connected devices, so adding a device raises throughput. - A message waits in
queuedwhile no device is free. If no device sends it within 24 hours it ends asexpiredand is not charged.
Statuses and webhooks
Messages have channel: "whatsapp_connect" and fire the usual webhook events.
| Status | Meaning | Charged |
|---|---|---|
queued | Waiting for a device. | — |
submitted | Accepted by WhatsApp’s servers (one grey tick). | Yes |
delivered | Reached the recipient’s phone (two ticks). | Yes |
rejected | The number is not on WhatsApp (NOT_ON_WHATSAPP). | No |
failed | WhatsApp refused it or the media could not be sent. | Refunded if your rate includes failure refunds |
expired | No device sent it within 24 hours. | No |
Receive messages
Messages people send to a linked number — text, photos, videos, voice notes, documents, stickers, locations and contacts — are stored as they arrive, including messages posted in groups the number is in. Status updates and channels are ignored. You can read and reply to them in the dashboard (WhatsApp Connect → Inbox), list them with GET /inbound, and receive them as message.received webhooks.
- Each device has
receiveInbound(on by default) and an optionalinboundProjectId. Without one, a message is reported under the project that last messaged the person, else your oldest project. Webhooks of that project receive it. - Replies starting with STOP add the sender to your opt-out list (campaigns skip them); START removes them. This only applies to direct messages, not to what people say in groups.
- Group messages carry
groupId(the group, "…@g.us");fromis the member who wrote it andsenderNametheir profile name. When WhatsApp hides a member's number,fromis their privacy ID instead of a phone number. Reply to the group by sending to itsgroupId. Direct messages havegroupId: null. - Receiving is free. A reply you send is an ordinary WhatsApp Connect message: send it with
deviceIdset to the device the person wrote to.
Webhook payload
Subscribe an endpoint to message.received (dashboard: WhatsApp Connect → Webhooks, which also sends a sample event). WhatsApp Connect events carry channel: "whatsapp_connect":
{
"id": "evt_01k6c0w1v9ph7n3x2q8r5s4t6m",
"event": "message.received",
"timestamp": "2026-10-03T09:41:07.000Z",
"inboundId": "inb_01k6c0w1v4m2f8e6d0c9b7a5z3",
"channel": "whatsapp_connect",
"deviceId": "wad_01k5x7r2b8n4m6q0w3e5t7y9u1",
"from": "919876543210",
"senderName": "Asha Sharma",
"groupId": null,
"to": "919812345678",
"text": "[image] Is this the right size?",
"media": {
"type": "image",
"mimeType": "image/jpeg",
"filename": null,
"url": "https://sms21.in/v1/inbound/inb_01k6c0w1v4m2f8e6d0c9b7a5z3/media"
},
"keyword": null,
"action": "none"
}| Field | Type | Description | |
|---|---|---|---|
from | string | required | The sender, E.164 digits without "+". |
to | string | required | Your linked number that received it. |
senderName | string | null | required | Their WhatsApp profile name, when shared. |
text | string | required | The message. Media is labelled, e.g. [image] caption, [location] … maps link. Untrusted input. |
media | object | null | required | type (image, video, audio, document, sticker), mimeType, filename and url. Download the file with an API key of the project (scope reports:read). Files up to 16 MB are kept. |
deviceId | string | required | The device (wad_…) — use it to reply from the same number. |
Fetch messages and files
# Newest first; also filter with from, to, receivedFrom, receivedTo
curl "https://sms21.in/v1/inbound?channel=whatsapp_connect" -H "X-API-Key: $SMS21_API_KEY"
# The photo, voice note or document of one message
curl -o file.bin "https://sms21.in/v1/inbound/inb_01k6c0w1v4m2f8e6d0c9b7a5z3/media" -H "X-API-Key: $SMS21_API_KEY"Billing
Each message is charged at the WhatsApp Connect price in your rate card, held from your wallet when it is queued. On a subscription plan, messages first use the plan’s monthly allowance; beyond it they are charged from the wallet at the plan’s overage price. Without enough balance the request fails with 402 INSUFFICIENT_BALANCE.
Errors
| HTTP | Code | What to do |
|---|---|---|
| 403 | PLUGIN_NOT_ACTIVE | Activate WhatsApp Connect under Plugins. |
| 403 | PLUGIN_NOT_AVAILABLE | The plugin is switched off platform-wide; contact support. |
| 409 | WA_DEVICE_NOT_LINKED | Link a device and scan its QR code first. |
| 400 | WA_MEDIA_URL_INVALID | Use a public https URL of a supported type. |
| 404 | NOT_FOUND | The deviceId or listId is not in this company, or none of your numbers is in the groupId. |
| 402 | INSUFFICIENT_BALANCE | Top up the wallet. |
Test keys
delivered after a moment, and numbers ending in 0000 are reported as not on WhatsApp (rejected). Test messages are never charged.Every field and response is in the API reference under WhatsApp Connect.