The life of a campaign
A campaign is created as a draft. It ends when itsend_at date has passed. A campaign that could not start is failed, with the reason in failure_reason; fix it and launch it again. You can edit a draft, a failed or a paused campaign; pause a scheduled or running campaign before editing it.
1. Create the campaign
POST /campaigns
Automatic campaigns (
new_conversation) also take once_per_contact (a contact gets the message once), send_delay_minutes (wait after the conversation starts) and min_inactive_minutes (wait for the conversation to be quiet).
Messages
WhatsApp sends an approved template, with a value for each of its variables:
The
source of a variable is:
field:firstname,field:lastname,field:name,field:email,field:phone,field:addressorfield:identifier: a field of the contact;column:<key>: a column of the imported file, mapped asvar:<key>;text, withvalue: the same text for everyone.
fallback is used when the contact has no value, so no message goes out with an empty variable. An automatic campaign may send a plain { "text": "..." } instead of a template.
Email takes a subject and an html body. Texts accept @firstname, @<column> and @{key|fallback}.
Audience
A contact file
Upload a.xlsx or .csv file with a phone number column, then map and check it:
1
Upload
IMP-XXXXX) and its columns, with their header, sample values and a guessed target. Numbers without a country code get your company’s.2
Map the columns
PATCH /campaign-imports/{id} with what each column holds, by index: phone (one column, required), first_name, last_name, email, var:<key> (a variable for the message) or ignore.3
Check
POST /campaign-imports/{id}/check counts the valid numbers, the merged duplicates, the invalid numbers (with their row), the unsubscribed contacts and the new contacts. With "marketing": true (default), unsubscribed contacts are counted out. A large file is checked in the background: GET /campaign-imports/{id} until its status is checked.2. Check and estimate
Before launching,GET /campaigns/{id}/checks lists what must be true:
senders, the messages, the template, the audience, the variables, the dates and the credit. A block check stops the launch; a warn check does not.
GET /campaigns/{id}/estimate gives the cost: the reachable recipients per channel times the price of one message, which depends on its category (the template’s, on WhatsApp) and on the recipient’s country.
3. Launch
POST /campaigns/{id}/launch sends now, or at start_at when it is in the future:
active and sends on each new conversation.
4. Pause, resume, duplicate
GET /campaigns lists your campaigns, most recent first, filterable by status and name.