Send a batch
Put your messages in amessages array. Each one looks exactly like a regular send. They don’t have to share a template, and the same phone number can appear more than once.
REST API
Idempotency-Keyprotects you from sending a batch twice. So does an identifier per message. See retries.biz_opaque_callback_datais your own name for the message. See follow each message.
What you get back
Kapso answers immediately with one line per message, in the same order you sent them:queued means Kapso has the message and will send it. Nothing has gone to WhatsApp yet.
If one message is malformed, only that message is refused. The rest are still queued:
202 either way, so check every line.
At this point Kapso has only checked that each message is well formed. Whether the template exists, whether the contact opted out, and whether you have enough balance are checked later, when the message is actually sent.
Follow each message
Give each message your own reference inbiz_opaque_callback_data, for example your invoice or order id. Kapso and WhatsApp send it back with every update about that message, so you always know which one it is.
There are two possible endings for a queued message.
It was sent. You get the same message events as for any other send: whatsapp.message.sent, then delivered and read, or failed. Your reference is inside message.kapso:
whatsapp.message.not_sent with the reason. In almost every case the message never reached WhatsApp. The one exception is send_outcome_unknown, where it may have been delivered, so check retryable before you send it again. Add this event to your phone-number webhook:
biz_opaque_callback_data, Kapso fills it with the id from the response.
Why a message is not sent
retryable is false only for send_outcome_unknown. In every other case the message did not reach WhatsApp, so sending it again cannot produce a duplicate.
If your request fails, send it again
Networks drop. If you don’t get a response, you can’t know whether Kapso received the batch. There are two ways to retry without sending anything twice. Resend the same request. Send anIdempotency-Key header with every request, using a value you make up and never reuse. If you have to retry, send the exact same request with the same key. Kapso recognizes it, returns the original response, and queues nothing a second time.
- The body has to be identical. The same key with a different body is rejected with
409. - Kapso remembers a key for at least 24 hours.
kapso.identifier:
idandstatusare those of the original message, as it is right now. A repeat is never an error.- Kapso remembers an identifier for at least 24 hours.
- Only the identifier is compared. If you reuse one with different content, you get the original back.
- To send again a message that was not sent, use a new identifier.
id is Kapso’s id for the message. kapso.identifier is yours.
Use the header if you always retry a batch exactly as it was. Use identifiers if your system rebuilds batches. Without either, a request that goes through twice sends its messages twice.
How Kapso sends the queue
- In the order you sent them. A contact never gets two of your messages out of order.
- One at a time per contact. Messages to the same contact go out one after the other, each once the previous one has been sent. Several messages to one phone take longer than the same number of messages to different phones.
- At your number’s speed. 60 messages per second by default. If WhatsApp slows your number down, Kapso waits and continues on its own. Contact support if your number supports a higher rate.
- Only once. Kapso never sends the same queued message to WhatsApp twice.
- Within 4 hours. Anything still waiting after that is dropped and reported as
expired.
If you run out of balance
If you pay with Kapso credits and your balance can’t cover the next template, sending pauses. Your messages stay in the queue. Top up and sending picks up where it left off within a couple of minutes. The same thing happens if WhatsApp restricts your account or there is a payment problem: the queue waits until it’s fixed. Messages that wait longer than 4 hours expire.Look up a message
Webhooks tell you everything, but you can also ask. Pass up to 100 ids:REST API
status is queued, sent or failed. Kapso keeps this for 3 days.
Errors
A single message can be refused with:
The whole request is refused with:

