Lewati ke konten

Send WhatsApp Messages (Batch)

POST
/v1/{phone_number_id}/messages/batch
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.

phone_number_id
required
string

WhatsApp sender phone number ID

Media type application/json
object
messages
required

1 to 100 messages. Each is a normal send body for this sender phone.

Array<object>
object
idempotency_key

Optional per-item idempotency key (same rules as the Idempotency-Key header of the single send, max 256 chars).

string | null
message
required

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
audio
One of:
null
category

Meta 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).

string | null
Example
utility
contact
One of:
null
custom_properties

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.

object | null
document
One of:
null
image
One of:
null
interactive
object
location
One of:
null
messaging_product
required

The messaging service to use. Must be “whatsapp”.

string
Example
whatsapp
processing_strategy
One of:
null
rbm

Optional. RCS rich-message / template payload (legacy field name rbm on wire).

object
reaction
One of:
null
recipient

The recipient’s WhatsApp BSUID. Set this instead of to to address a user by BSUID.

string | null
Example
ID.4382118765401508
sms_failover
One of:
null
sticker
One of:
null
template
One of:
null
test

Optional. 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.

boolean | null
text
One of:
null
to

The recipient’s phone number in E.164 format. Optional if recipient is provided.

string
Example
+6281234567890
ttl_seconds

Direct Send message time-to-live in seconds (30..=43200). Only allowed together with category.

integer | null format: int32
Example
600
type
required

The type of message being sent.

string
Example
template
video
One of:
null
Example
{
"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"
}
]
}
]
}
}

Batch processed; see per-item results

Media type application/json
object
accepted
required
integer format: int32
messaging_product
required
string
rejected
required
integer format: int32
results
required
Array<object>
object
error
One of:
null
id
string | null
idempotent_replayed
boolean
index
required
integer format: int32
status
required

“accepted” | “rejected”

string
to
required
string
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