A campaign sends the same message to a list of contacts, with personalised variables, then measures the result. Two formats:
- Meta template: to write outside the 24-hour window (marketing, utility…). The model must be approved.
- Free-form message (
text): personalised text, only for contacts whose 24-hour window is open. Useful in coexistence to reply in bulk without a template.
The campaigns API is available from Starter; the portal UI requires Pro (402 plan_feature_required otherwise).
Try it with your list
Hover or click a step to see what it does.
1. Prepare#
POST /campaigns creates a draft from recipients (a list of numbers with their variables) and/or an audience (tags, excludeTags, writtenWithinDays, all, numbers).
Template#
{
"connectionId": "con_...",
"template": { "name": "december_promo", "language": "en" },
"audience": { "tags": ["VIP"], "excludeTags": ["inactive"] },
"variableMap": [
{ "source": "name", "default": "there" },
{ "source": "field", "key": "city", "default": "your city" }
]
}
variableMap fills each template variable from the contact: name, phone, field (an imported field) or text (a fixed value), with a default if the contact has nothing.
Free-form (24-hour window)#
{
"connectionId": "con_...",
"text": "Hello {{name|there}}, thanks for your message. We will get back to you.",
"audience": { "tags": ["VIP"] }
}
Placeholders in text:
| Placeholder | Source |
|---|---|
{{name}}, {{phone}} |
Contact |
{{city}}, {{order}}… |
Imported contact field (shortcut) |
{{field:city}} |
Same, explicit form |
{{date}} / {{aujourd_hui}} |
Today's date (d/m/Y) |
{{datetime}} / {{maintenant}} |
Date and time |
{{entreprise}} / {{company}} |
Company name of the sending number |
{{numero}} / {{business_phone}} |
WhatsApp sending number |
A default is written {{name|there}} or {{city|Paris}}. At preparation and just before each send, only contacts still inside the 24-hour window go out; others are skipped (window_closed). In the portal, the audience is pre-filtered to contacts who wrote to you in the last day.
At creation, numbers are normalised and deduplicated. These are set aside and counted by reason in skippedBy:
| Reason | Meaning |
|---|---|
opted_out |
The contact replied STOP. |
no_consent |
Marketing template with no declared consent and no message received from the contact. |
duplicate |
The same number appears twice. |
invalid_number |
Impossible number for its country. |
missing_variable |
A variable has neither a value nor a default. |
window_closed |
Free-form: the 24-hour window is closed for this contact. |
2. Check#
GET /campaigns/{id}/preview gives you, before any send: the recipients kept, those set aside by reason, the estimated duration, the number's sending tier and quality rating, and what it uses of your quota. POST /campaigns/{id}/test sends a test to one number (it counts toward the quota).
3. Launch#
POST /campaigns/{id}/launch launches the campaign, or schedules it with scheduledAt (up to 60 days). Before the first message, the list is checked:
- if it exceeds your monthly quota, the campaign is refused (402,
plan_limit_messages); - if it exceeds the number's 24-hour sending tier (250, 1,000, 10,000 recipients…), it is refused (
daily_limit_exceeded).
Messages go out in waves to respect Meta's rate. For a free-form message, the 24-hour window is checked again just before each send.
4. Stay in control#
POST /campaigns/{id}/pause, /resume and /cancel take effect immediately. The remaining sends of a cancelled campaign are set aside.
5. Measure#
GET /campaigns/{id}/report gives delivery, read, reply (within 72 hours), button click and STOP rates, the hour-by-hour curve and failure causes. GET /campaigns/{id}/export exports every recipient as CSV.
6. Follow up#
POST /campaigns/{id}/retarget prepares a new draft with those who did not read (not_read), did not reply (not_replied) or whose send failed (failed).