API Create Broadcast Campaign
このページは 日本語 ではまだ利用できません。デフォルトの言語 (English) で表示しています。
API Create Broadcast Campaign
POST {BASE_URL}/api/campaigns
Create a broadcast campaign that sends a WhatsApp template message to every recipient in a recipient list, the same as creating one from the dashboard. The request requires a sender inbox, a recipient list, and a template; a conversation label and a schedule time are optional. A successful request returns the campaign id, campaign_name, status, and created_at, and the campaign is immediately visible on the dashboard under Broadcast Settings > Campaign.
Create Broadcast Campaign Method
| HTTP Method | Endpoint | Description |
|---|---|---|
| POST | {BASE_URL}/api/campaigns | Create a broadcast campaign |
Create Broadcast Campaign Request
Request Headers
Content-Type: application/json
authorization: api_key {{YOUR_API_KEY}}
Sample Request
{
"campaign_name": "Promo Oktober 2026",
"inbox_id": "a1b2c3d4-0000-1111-2222-333344445555",
"recipient_list_id": "f6e5d4c3-9999-8888-7777-666655554444",
"template_id": "11223344-5566-7788-99aa-bbccddeeff00",
"label_id": "22334455-6677-8899-aabb-ccddeeff0011",
"schedule_at": "2026-10-15T09:00:00+07:00",
"template_body_variables": ["name", "additional_data.umur", "PROMO17"]
}
| JSON Attribute | Description | Type | Required |
|---|---|---|---|
campaign_name | Name of the campaign. | String | Required |
inbox_id | ID of the sender inbox. Only WhatsApp inboxes are supported. Use GET /api/inboxes to retrieve valid IDs. | String | Required |
recipient_list_id | ID of the recipient list to send to. Raw phone numbers are not accepted directly; recipients must come from a recipient list. Use GET /api/recipients to retrieve valid IDs. | String | Required |
template_id | ID of the WhatsApp template to send. Use GET /api/templates to retrieve valid IDs. | String | Required |
label_id | ID of the conversation label applied to every conversation this campaign generates. Use GET /api/labels to retrieve valid IDs. | String | Optional |
schedule_at | Scheduled send time, ISO 8601. If omitted, the campaign sends immediately. Cannot be a past datetime. | String (datetime) | Optional |
template_body_variables | Ordered array of values for the variables in the template body ({{1}}, {{2}}, ...), array position maps to variable index. See Resolving template_body_variables below for how each entry is read. Required only if the template body has variables; array length must equal the number of variables in the template body. | Array of String | Conditional |
Resolving template_body_variables
Each entry resolves to a value per recipient using one of three rules, based on how the entry is written:
| Entry format | Resolves to | Example |
|---|---|---|
Exact column name, only name or phone_number |
The recipient’s value in that column, matched per recipient. | "name" → that recipient’s value in the name column |
additional_data.<column_name> |
The recipient’s value in that column, for any column in the recipient list other than phone_number and name. Matched per recipient. |
"additional_data.umur" → that recipient’s value in the umur column |
| Anything else (free text) | Sent as-is, unchanged, to every recipient. | "PROMO17" → every recipient receives PROMO17 |
No silent fallback on typos: if additional_data.<column_name> references a column that doesn’t exist, for example additional_data.umru instead of additional_data.umur, it is not rejected and not skipped. It falls into the third rule above and is sent to the customer exactly as written, typo included. Double check column names before sending.
cURL Example
curl --location '{BASE_URL}/api/campaigns' \
--header 'Content-Type: application/json' \
--header 'authorization: api_key {{YOUR_API_KEY}}' \
--data '{
"campaign_name": "Promo Oktober 2026",
"inbox_id": "a1b2c3d4-0000-1111-2222-333344445555",
"recipient_list_id": "f6e5d4c3-9999-8888-7777-666655554444",
"template_id": "11223344-5566-7788-99aa-bbccddeeff00",
"schedule_at": "2026-10-15T09:00:00+07:00",
"template_body_variables": ["name", "additional_data.umur", "PROMO17"]
}'
Create Broadcast Campaign Response
Success Response (201)
{
"id": "d1e2f3a4-0000-1111-2222-333344445555",
"campaign_name": "Promo Oktober 2026",
"status": "processing",
"created_at": "2026-10-01T10:04:00+07:00"
}
| JSON Attribute | Description | Type |
|---|---|---|
id |
Campaign ID generated by Cekat. | String |
campaign_name |
Campaign name, as submitted. | String |
status |
processing if the campaign sends immediately, scheduled if schedule_at was provided. |
String |
created_at |
Campaign creation timestamp. | String (datetime) |
Error Responses
| Status Code | When it happens |
|---|---|
| 401 | Missing or invalid API key |
| 422 | A required field is missing, inbox_id / recipient_list_id / template_id is invalid, schedule_at is in the past, template_body_variables length does not match the number of variables in the template body, or an entry in template_body_variables is an empty string |
| 503 | Campaign failed to queue |
Sample 422: variable count mismatch
{
"success": false,
"message": "Template variable count does not match. Template expects 2, received 3."
}
Notes
- Only WhatsApp inboxes are supported as
inbox_id. - The expected
template_body_variableslength is the highest variable index in the template body, so a repeated index (for example{{1}}used twice) counts once. template_body_variablesdoesn’t cover variables in the template header (including media headers) or in URL buttons, and there is no resolution preview in the201response showing which entries matched a column versus which were sent as literals.{BASE_URL}is a placeholder. Confirm the production host with engineering before use.