Send WhatsApp Messages (Batch)
const url = 'https://example.com/v1/example/messages/batch';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"messages":[{"idempotency_key":"example","message":{"messaging_product":"whatsapp","to":"+6281234567890","type":"template","template":{"name":"order_confirmation","language":{"code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"John Doe"},{"type":"text","text":"ORD-12345"}]}]}}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/example/messages/batch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "messages": [ { "idempotency_key": "example", "message": { "messaging_product": "whatsapp", "to": "+6281234567890", "type": "template", "template": { "name": "order_confirmation", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "John Doe" }, { "type": "text", "text": "ORD-12345" } ] } ] } } } ] }'Sends 1 to 100 messages from one sender phone in one request. Each item goes through the same checks, budget, queue and limits as a single send and gets its own msg_ id or error. The request is accepted (202) when the envelope is valid, even if some items are rejected.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”WhatsApp sender phone number ID
Request Body required
Section titled “Request Body required ”object
1 to 100 messages. Each is a normal send body for this sender phone.
object
Optional per-item idempotency key (same rules as the Idempotency-Key header of the single send, max 256 chars).
The main request body for sending any type of message. This structure mirrors the Meta Graph API for sending messages. See: https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/send-messages
object
Represents a media object to be sent. Use either id for managed media or link for a public URL.
object
The persistent media_id obtained from a /media upload endpoint.
Example
f7a816e2-8397-11f0-8e34-010203040506A public URL to the media file. The system will download and send it on your behalf.
Example
https://example.com/product.jpgMeta Direct Send category. Valid with freeform text, or interactive of type cta_url or
button (any header type); never with template.
Allowed values: “utility”, “authentication” (case-insensitive on input; stored lowercase).
Example
utilityRepresents contact information to be sent as a contact card.
object
Physical addresses associated with the contact.
object
The city.
Example
MakassarThe country.
Example
IndonesiaThe country code.
The state or province.
The street address.
Example
Jl. BoulevardThe type of address (HOME, WORK, etc.).
Example
WORKThe ZIP or postal code.
Birthday of the contact (ISO 8601 date format).
Example
1990-05-15Email addresses associated with the contact.
object
The email address.
Example
john@example.comThe type of email (HOME, WORK, etc.).
Example
WORKExample
[ "john@example.com"]Full name of the contact.
object
The first name of the contact.
Example
JohnThe formatted name of the contact as it should be displayed.
Example
John DoeThe last name of the contact.
Example
DoeThe middle name of the contact.
The prefix for the contact’s name.
The suffix for the contact’s name.
Phone numbers associated with the contact.
object
The phone number.
Example
+6281234567890The type of phone number (HOME, WORK, etc.).
Example
WORKThe WhatsApp ID for the phone number.
Example
[ "+6281234567890"]URLs associated with the contact.
object
The type of URL (HOME, WORK, etc.).
Example
WORKThe URL.
Example
https://example.comExample
[ "https://example.com"]Optional custom metadata key-value pairs. Stored and returned in webhooks, but never sent to the provider (e.g. Meta). Use this for client-specific tracking fields like division_id, branch_code, etc.
Represents a media object to be sent. Use either id for managed media or link for a public URL.
object
The persistent media_id obtained from a /media upload endpoint.
Example
f7a816e2-8397-11f0-8e34-010203040506A public URL to the media file. The system will download and send it on your behalf.
Example
https://example.com/product.jpgRepresents a media object to be sent. Use either id for managed media or link for a public URL.
object
The persistent media_id obtained from a /media upload endpoint.
Example
f7a816e2-8397-11f0-8e34-010203040506A public URL to the media file. The system will download and send it on your behalf.
Example
https://example.com/product.jpgobject
Represents a location to be sent as a standalone location message.
object
Address of the location (optional).
Example
Jl. Boulevard, MakassarLatitude of the location.
Example
-6.17539218535067Longitude of the location.
Example
106.82733591282204Name of the location (optional).
Example
MakassarThe messaging service to use. Must be “whatsapp”.
Example
whatsappOptional. Determines how the message is processed. ‘broadcast’ is optimized for high-throughput, while ‘inbox’ integrates the message into the live chat history. When omitted, defaults to the tenant’s API inbox storage setting (‘broadcast’ unless enabled by an administrator).
Optional. RCS rich-message / template payload (legacy field name rbm on wire).
object
The recipient’s WhatsApp BSUID. Set this instead of to to address a user by BSUID.
Example
ID.4382118765401508Represents a media object to be sent. Use either id for managed media or link for a public URL.
object
The persistent media_id obtained from a /media upload endpoint.
Example
f7a816e2-8397-11f0-8e34-010203040506A public URL to the media file. The system will download and send it on your behalf.
Example
https://example.com/product.jpgDefines the template to be sent.
object
Contains the dynamic components of the template, such as body parameters.
object
Carousel cards (component type “carousel”) in Meta Cloud API shape. Passed through verbatim:
[{"card_index":0,"components":[{"type":"header","parameters":[...]}]}, ...].
object
Button index (0-based). Accepts both string “0” and integer 0.
Template parameters in Meta WhatsApp Cloud API shape. Passed through to Meta verbatim.
Examples: {"type":"text","text":"John"}, {"type":"image","image":{"link":"..."}},
{"type":"coupon_code","coupon_code":"ABC123"},
{"type":"currency","currency":{"fallback_value":"$10","code":"USD","amount_1000":10000}}.
object
The type of component (e.g., ‘header’, ‘body’, ‘button’).
Example
bodyThe language object for the template.
object
The language and locale code.
Example
en_USThe name of the template to send.
Example
order_confirmationOptional. When true, performs all validation (auth, planning, template resolution, pricing, balance check) but does NOT reserve balance or publish the outbound job. Response is 200 OK with a diagnostic JSON body showing whether the real send would have succeeded. Intended for troubleshooting 402/400 responses without charging.
The recipient’s phone number in E.164 format. Optional if recipient is provided.
Example
+6281234567890Direct Send message time-to-live in seconds (30..=43200). Only allowed together with category.
Example
600The type of message being sent.
Example
templateRepresents a media object to be sent. Use either id for managed media or link for a public URL.
object
The persistent media_id obtained from a /media upload endpoint.
Example
f7a816e2-8397-11f0-8e34-010203040506A public URL to the media file. The system will download and send it on your behalf.
Example
https://example.com/product.jpgExample
{ "messaging_product": "whatsapp", "to": "+6281234567890", "type": "template", "template": { "name": "order_confirmation", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "John Doe" }, { "type": "text", "text": "ORD-12345" } ] } ] }}Responses
Section titled “ Responses ”Batch processed; see per-item results
object
object
“accepted” | “rejected”
Example generated
{ "accepted": 1, "messaging_product": "example", "rejected": 1, "results": [ { "error": { "code": 1, "error": "example", "message": "example" }, "id": "example", "idempotent_replayed": true, "index": 1, "status": "example", "to": "example" } ]}Empty batch or more than 100 messages
Unauthorized - Invalid API Key