Send a message
POST /messages/whatsapp — scope WHATSAPP_SEND.
A message is a template, free text or media, exactly one of the three.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
to |
string | yes | the recipient, international form: +919876543210 |
from |
string | no | which of your numbers to send from. Omitted: your default number, or your only one |
template |
object | one of three | { name, language, variables, urlButtonParams?, trackButtons?, headerMedia? } — the only form deliverable outside the window, and the only one that can carry a file outside it. See attaching a file |
text |
string | one of three | 1–4096 characters. Inside the window only |
media |
object | one of three | see Media |
idempotencyKey |
string | no | 8–128 characters. A repeat returns the first result instead of sending again; while the first is still sending, 409 SEND_IN_PROGRESS |
metadata |
object | no | your own JSON, stored and returned on every read of this message |
Template
Section titled “Template”The only form Meta allows outside the 24-hour window.
{ "to": "+919876543210", "from": "+919812345678", "template": { "name": "order_shipped", "language": "en_US", "variables": { "name": "Ravi", "order_id": "BLR-4471" } }, "idempotencyKey": "order-4471-shipped"}variables is an object, not a list, because WhatsApp templates can be named as well
as numbered:
{ "name": "Ravi", "order_id": "BLR-4471" } // named: {{name}}, {{order_id}}{ "1": "Ravi", "2": "BLR-4471" } // numbered: {{1}}, {{2}}language defaults to en_US. Every variable the template declares must be present and
non-empty, or the send is refused with 400 MISSING_VARIABLES — GET /templates tells you
which ones a template needs.
Link buttons
Section titled “Link buttons”A URL button approved with {{1}} needs a value on every send, keyed by the button’s position
in the template (counting every button from 0). GET /templates lists them under urlButtons.
takes: "suffix": the domain is fixed (https://shop.com/orders/{{1}}). Send the end of the link, such as an order ID:"BLR-4471"openshttps://shop.com/orders/BLR-4471.takes: "url",trackable: true: the template was made with Any link (tracked). Send the full destination, any address you like. Vaarto makes a short code for this one send, puts it at the end of the button’s link, counts the click and redirects to your destination. You never build the code yourself.
"template": { "name": "diwali_offer", "language": "en_US", "urlButtonParams": { "0": "https://myshop.com/offer/diwali" }, "trackButtons": { "0": true }}On the customer’s phone the button opens https://app.vaarto.com/api/v1/c/<code>, which forwards
to https://myshop.com/offer/diwali.
trackButtonsis optional: a tracked-link button counts clicks unless you sendfalsefor it. Withfalseit still opens through Vaarto, just without counting.- Send a full
https://link; one without a scheme getshttps://in front. - A fixed-domain button cannot be tracked: its link opens your site directly, so Vaarto never sees the click.
- Meta allows one placeholder per URL button, always
{{1}}, always at the end of the link.
A dynamic button without a value is refused with 400 MISSING_BUTTON_PARAMS; a tracked-link
button whose value is not a usable https:// link with 400 BAD_REQUEST.
Free text
Section titled “Free text”Inside an open window only.
{ "to": "+919876543210", "text": "Your order is out for delivery." }Your own metadata
Section titled “Your own metadata”metadata is yours: up to 50 keys and 8 KB once serialized, keys up to 64 characters. Use
it to carry your own order or ticket id so a webhook or a log read can be matched back to
your records without a lookup table.
We never read inside it, so never put a secret there.
Response
Section titled “Response”201 Created, or 200 OK when an idempotencyKey replayed:
The full message, in the same shape GET /messages returns it:
{ "data": { "id": "cmu102948182741", "channel": "WHATSAPP", "direction": "OUTBOUND", "status": "SENT", "kind": "TEMPLATE", "to": "+919876543210", "from": "+919812345678", "contactName": "Ravi Kumar", "conversationId": "cmu0998127731", "text": "Hi Ravi, your order BLR-4471 has shipped.", "caption": null, "templateName": "order_shipped", "variables": { "name": "Ravi", "order_id": "BLR-4471" }, "hasMedia": false, "mediaId": null, "mediaMimeType": null, "mediaFilename": null, "providerMessageId": "wamid.HBgM109…", "metadata": { "orderId": "A-1043" }, "details": null, "error": null, "createdAt": "2026-09-27T10:00:00.000Z", "sentAt": "2026-09-27T10:00:00.412Z", "deliveredAt": null, "readAt": null, "failedAt": null }, "meta": { "replayed": false }}to is always + and digits, however you wrote it. details carries the buttons or list
of an interactive message. status is SENT once Meta accepted it, FAILED if Meta
refused — with the reason in error.
When Meta refuses
Section titled “When Meta refuses”A refused send still records the message, and error says why in a form you can branch on:
"error": { "code": "RECIPIENT_UNAVAILABLE", "message": "This number cannot receive WhatsApp messages — it may not be on WhatsApp, or it blocked this business.", "metaCode": 131026, "metaMessage": "Message undeliverable"}Keys created from now on also answer a refusal with an error status — 422 for a problem
with the recipient, template or message, 429 when Meta is rate limiting, 502 for the
account or anything else on Meta’s side — and the body carries both error and the recorded
message in data. Keys
created earlier keep answering 201 with data.status: "FAILED".
code |
Meaning |
|---|---|
RECIPIENT_UNAVAILABLE |
Not on WhatsApp, or blocked this business |
INVALID_RECIPIENT |
The number cannot be messaged from this one |
WINDOW_CLOSED |
Outside the 24-hour window: send a template |
MARKETING_LIMIT |
Meta held back a marketing message for this person |
TEMPLATE_NOT_FOUND |
No approved template with that name and language |
TEMPLATE_PAUSED / TEMPLATE_DISABLED |
Meta paused or disabled the template for quality |
TEMPLATE_PARAMS_INVALID |
A filled-in value does not fit the template |
MEDIA_INVALID |
Meta could not take the attached media |
UNSUPPORTED_MESSAGE |
Meta does not accept this kind of message |
ACCOUNT_RESTRICTED / BILLING_ISSUE / NUMBER_NOT_REGISTERED |
Fix the WhatsApp account in WhatsApp Manager |
META_RATE_LIMITED |
Slow down and retry later |
META_AUTH_FAILED |
The connected account’s access needs renewing |
META_UNREACHABLE |
No answer from Meta: it may or may not have gone out |
PROVIDER_REJECTED |
Anything else; see metaCode and metaMessage |
Delivery is not confirmed yet: DELIVERED and READ arrive later, as
webhooks or on a later read.
Idempotency
Section titled “Idempotency”idempotencyKey is scoped to your workspace. Re-sending the same key returns the original
message with 200 and meta.replayed: true, and never calls Meta twice — which is what
makes a retry after a timeout safe.
One exception: a send refused on the spot with META_RATE_LIMITED never went out, so it
does not hold its key. Retrying with the same key after backing off sends it for real. A
failure reported later by webhook does hold it, because Meta had already taken the message.
Key it on the event that caused the send — order-4471-shipped — not on a fresh UUID. A
random key per attempt is not idempotent.
Failures
Section titled “Failures”| Failure | HTTP | Code |
|---|---|---|
| free text or media with no open window | 409 | WINDOW_CLOSED |
| no template with that name and language | 404 | TEMPLATE_NOT_FOUND |
| template not approved by Meta | 409 | TEMPLATE_NOT_APPROVED |
| a template variable is missing or blank | 400 | MISSING_VARIABLES |
from is not one of your numbers |
404 | NUMBER_NOT_FOUND |
from has not finished registering with Meta |
409 | NUMBER_NOT_REGISTERED |
| you have no number that can send yet | 409 | CHANNEL_NOT_CONFIGURED |
Preview a template
Section titled “Preview a template”POST /messages/whatsapp/preview — scope WHATSAPP_SEND. Fills a stored template with the
values you pass and returns the text Meta would render, without sending anything. Useful
for showing an operator what is about to go out.
curl -X POST "https://vaarto.com/api/v1/messages/whatsapp/preview" \ -H "Authorization: Bearer $VAARTO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "templateName": "order_shipped", "language": "en_US", "variables": { "1": "Rahul", "2": "ORD-9921" } }'const res = await fetch("https://vaarto.com/api/v1/messages/whatsapp/preview", { method: "POST", headers: { Authorization: `Bearer ${process.env.VAARTO_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ templateName: "order_shipped", language: "en_US", variables: { "1": "Rahul", "2": "ORD-9921", }, }),});
const { data } = await res.json();import os, requests
res = requests.post( "https://vaarto.com/api/v1/messages/whatsapp/preview", headers={"Authorization": f"Bearer {os.environ['VAARTO_API_KEY']}"}, json={ "templateName": "order_shipped", "language": "en_US", "variables": { "1": "Rahul", "2": "ORD-9921", }, }, timeout=10,)
data = res.json()["data"]$data = Http::withToken(env('VAARTO_API_KEY')) ->post('https://vaarto.com/api/v1/messages/whatsapp/preview', [ 'templateName' => 'order_shipped', 'language' => 'en_US', 'variables' => [ '1' => 'Rahul', '2' => 'ORD-9921', ], ]) ->json('data');variables accepts an object (named or numbered keys) or a plain array in placeholder
order.
{ "data": { "templateName": "order_shipped", "language": "en_US", "category": "UTILITY", "status": "APPROVED", "header": "Order Status Update", "body": "Hi Rahul, your order ORD-9921 is confirmed.", "footer": "Thank you for shopping with us!", "buttons": ["Track Order"], "fullText": "Order Status Update\n\nHi Rahul, your order ORD-9921 is confirmed.\n\nThank you for shopping with us!" }}