Campaigns
· 15 endpoints
- GET/accounts/{accountId}/campaigns
- POST/accounts/{accountId}/campaigns
- GET/accounts/{accountId}/campaigns/{campaignId}
- PATCH/accounts/{accountId}/campaigns/{campaignId}
- DELETE/accounts/{accountId}/campaigns/{campaignId}
- POST/accounts/{accountId}/campaigns/{campaignId}/clone
- POST/accounts/{accountId}/campaigns/{campaignId}/status
- GET/accounts/{accountId}/campaigns/{campaignId}/contacts
- POST/accounts/{accountId}/campaigns/{campaignId}/contacts
- DELETE/accounts/{accountId}/campaigns/{campaignId}/contacts
- POST/accounts/{accountId}/campaigns/{campaignId}/contacts/from-label
- POST/accounts/{accountId}/campaigns/{campaignId}/contacts/from-group
- GET/accounts/{accountId}/campaigns/{campaignId}/send-log
- GET/accounts/{accountId}/campaigns-stats
- GET/accounts/{accountId}/campaigns-queue
The account's campaigns
GET
/api/v1/accounts/{accountId}/campaignsScope: crm:readParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns" \
-H "Authorization: Bearer dpk_xxx"Create a campaign (draft status)
POST
/api/v1/accounts/{accountId}/campaignsScope: crm:writeParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
Request body (JSON)
namerequired | string max 200 | |
campaign_typeoptional | "message" | "friend_request" | "mixed" default "message" | |
template_messageoptional | string | object default "" | Message content; supports the same variables as the UI ({name}...) or the editor's JSON blocks |
friend_request_messageoptional | string max 500 · default "" | |
mixed_configoptional | string | object | |
delay_secondsoptional | integer ≥ 5 · ≤ 86400 · default 60 | Delay between 2 contacts (seconds); the queue always waits at least 30 seconds |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","campaign_type":"message","template_message":""}'Get a campaign
GET
/api/v1/accounts/{accountId}/campaigns/{campaignId}Scope: crm:readParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}" \
-H "Authorization: Bearer dpk_xxx"Update a campaign
PATCH
/api/v1/accounts/{accountId}/campaigns/{campaignId}Scope: crm:writeParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
nameoptional | string max 200 | |
campaign_typeoptional | "message" | "friend_request" | "mixed" default "message" | |
template_messageoptional | string | object default "" | Message content; supports the same variables as the UI ({name}...) or the editor's JSON blocks |
friend_request_messageoptional | string max 500 · default "" | |
mixed_configoptional | string | object | |
delay_secondsoptional | integer ≥ 5 · ≤ 86400 · default 60 | Delay between 2 contacts (seconds); the queue always waits at least 30 seconds |
Example request
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","campaign_type":"message","template_message":""}'Delete a campaign
DELETE
/api/v1/accounts/{accountId}/campaigns/{campaignId}Scope: crm:writeParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Example request
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}" \
-H "Authorization: Bearer dpk_xxx"Duplicate a campaign
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/cloneScope: crm:writeParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
nameoptional | string max 200 | |
include_contactsoptional | boolean default false |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/clone" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","include_contacts":false}'Start / pause / finish a campaign
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/statusScope: campaigns:runactive starts the account's send queue (with the configured delay), paused pauses it, done finishes the campaign.
Parameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
statusrequired | "draft" | "active" | "paused" | "done" |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/status" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"status":"draft"}'Campaign recipients and their send status
GET
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contactsScope: crm:readParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts" \
-H "Authorization: Bearer dpk_xxx"Add recipients to a campaign
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contactsScope: crm:writeParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
contactsrequired | object[] max 5000 items | |
└contact_idrequired | string max 200 | |
└display_nameoptional | string max 200 | |
└phoneoptional | string max 30 | |
└avataroptional | string max 1000 |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"contacts":[]}'Remove recipients (a given list, or all)
DELETE
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contactsScope: crm:writeParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
contact_idsoptional | string[] max 5000 items | |
alloptional | boolean default false |
Example request
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"contact_ids":[],"all":false}'Add every conversation that has a given label to the campaign
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts/from-labelScope: crm:writeParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
label_idrequired | integer ≥ 1 | |
only_usersoptional | boolean default true | Skip group chats |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts/from-label" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"label_id":1,"only_users":true}'Add a group's (scanned/saved) members to the campaign
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts/from-groupScope: crm:writeSame as "Add to campaign" (Thêm vào chiến dịch) in the Group members tab (Thành viên nhóm). Members come from the saved list (scan the group members in the app first if it is empty).
Parameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 |
Request body (JSON)
group_idrequired | string max 200 | |
exclude_idsoptional | string[] max 5000 items · default [] |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts/from-group" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"group_id":"string","exclude_ids":[]}'Campaign send log
GET
/api/v1/accounts/{accountId}/campaigns/{campaignId}/send-logScope: crm:readParameters
accountIdpath · required | string max 200 | |
campaignIdpath · required | integer ≥ 1 | |
limitquery · optional | integer ≥ 1 · ≤ 1000 · default 200 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/send-log" \
-H "Authorization: Bearer dpk_xxx"Statistics of top campaigns
GET
/api/v1/accounts/{accountId}/campaigns-statsScope: crm:readParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
limitquery · optional | integer ≥ 1 · ≤ 100 · default 10 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns-stats" \
-H "Authorization: Bearer dpk_xxx"Campaign send queue status
GET
/api/v1/accounts/{accountId}/campaigns-queueScope: crm:readParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns-queue" \
-H "Authorization: Bearer dpk_xxx"