Create a broadcast
A broadcast sends one approved template to many contacts: an offer to everyone tagged VIP, a notice to a segment, a reminder to all. In the API a broadcast is called a campaign. This guide creates one, schedules it, and follows it to the end.
A broadcast is three choices #
- What to send: an approved WhatsApp template, and the values for its placeholders.
- Who gets it: every contact, contacts with certain tags, or a saved segment.
- When: now, or at a time you set.
Three things are taken care of for you, exactly as when a broadcast is made in the app. Contacts who opted out are skipped. Contacts without a phone number are skipped. And a broadcast never sends more than the plan’s monthly message allowance has left: if the audience is larger, the rest are skipped and the broadcast’s note says how many.
-
Choose the audience #
For tags, list them to get the exact names and how many contacts each has:
curl "https://chatilo.me/api/v1/tags" \ -H "Authorization: Bearer YOUR_API_KEY"For a segment, list the segments.
reachableis how many of its contacts can actually be messaged right now:curl "https://chatilo.me/api/v1/segments" \ -H "Authorization: Bearer YOUR_API_KEY"Segments are made in the app under Contacts. A segment is a filter, not a fixed list: who is in it is worked out when the broadcast starts sending.
-
Choose the template #
curl "https://chatilo.me/api/v1/templates?status=APPROVED" \ -H "Authorization: Bearer YOUR_API_KEY"Note the template’s
id(or its name and language) and itsvariables: how many body values it needs, and whether it has a header to fill. -
Check there is allowance left #
Look at
limits.messages.remaining. If it is zero, creating a broadcast answersmessage_limit.curl "https://chatilo.me/api/v1/account" \ -H "Authorization: Bearer YOUR_API_KEY" -
Create it #
This one goes to everyone tagged VIP, greets each person by first name, and starts on 20 December at 10:00 Indian time. Leave
scheduled_atout to start straight away.curl -X POST "https://chatilo.me/api/v1/campaigns" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Idempotency-Key: festive-offer-2026" \ -H "Content-Type: application/json" \ -d '{ "name": "Festive offer", "template": { "name": "festive_offer", "language": "en" }, "audience": { "type": "tags", "tags": [ "VIP" ] }, "variables": { "body": [ "{{first_name}}", "FESTIVE20" ] }, "scheduled_at": "2026-12-20T10:00:00+05:30" }'The answer is the broadcast, with
"status": "scheduled"and itsid. Keep the id. TheIdempotency-Keymatters here more than anywhere: without it, a retry after a dropped connection would create a second broadcast to the same people.Other audiences look like this:
{ "all contacts": { "type": "all" }, "any of several tags": { "type": "tags", "tags": [ "VIP", "Denver" ] }, "a segment": { "type": "segment", "segment_id": 4 } } -
Follow it #
Once it starts, messages go out in small batches over the following minutes. Ask for the broadcast to see the numbers move:
curl "https://chatilo.me/api/v1/campaigns/4001" \ -H "Authorization: Bearer YOUR_API_KEY"{ "ok": true, "campaign": { "id": 4001, "name": "Festive offer", "status": "sending", "total": 250, "sent": 120, "delivered": 112, "read": 64, "failed": 2, "replied": 9, "pending": 128, "note": null, "…": "…" } }totalis the audience as it was when sending began.deliveredandreadkeep rising after the broadcast iscompleted, as phones come online and people open the message.Rather than asking repeatedly, subscribe to the
campaign.finishedevent and you are told once when it is done: see webhooks.
Pause, resume or cancel #
Sent the wrong thing? Pausing takes effect within a few seconds. Messages already sent can’t be recalled.
curl -X POST "https://chatilo.me/api/v1/campaigns/4001/pause" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X POST "https://chatilo.me/api/v1/campaigns/4001/resume" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X POST "https://chatilo.me/api/v1/campaigns/4001/cancel" \
-H "Authorization: Bearer YOUR_API_KEY"Cancelling works on a scheduled, sending or paused broadcast and is final. The broadcast ends as completed, with a note that it was cancelled.
The life of a broadcast #
| Status | Meaning | What you can do |
|---|---|---|
scheduled | Waiting for its start time. | Cancel. |
sending | Messages are going out. | Pause or cancel. |
paused | Stopped part-way. | Resume or cancel. |
completed | Every message was attempted, or it was cancelled. | Read the numbers. |
failed | It could not run: the template was deleted or the plan ended. note says which. | Create a new one. |
WhatsApp limits how many people a number may start conversations with in a day, and raises the limit as the number earns a good quality rating. Messages beyond it show up under failed. Start with smaller audiences on a new number.