Skip to content

Campaigns

· 15 endpoints

The account's campaigns

GET/api/v1/accounts/{accountId}/campaignsScope: crm:read

Parameters

accountId
path · 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:write

Parameters

accountId
path · required
string
max 200
Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID.

Request body (JSON)

name
required
string
max 200
campaign_type
optional
"message" | "friend_request" | "mixed"
default "message"
template_message
optional
string | object
default ""
Message content; supports the same variables as the UI ({name}...) or the editor's JSON blocks
friend_request_message
optional
string
max 500 · default ""
mixed_config
optional
string | object
delay_seconds
optional
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:read

Parameters

accountId
path · required
string
max 200
campaignId
path · 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:write

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

name
optional
string
max 200
campaign_type
optional
"message" | "friend_request" | "mixed"
default "message"
template_message
optional
string | object
default ""
Message content; supports the same variables as the UI ({name}...) or the editor's JSON blocks
friend_request_message
optional
string
max 500 · default ""
mixed_config
optional
string | object
delay_seconds
optional
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:write

Parameters

accountId
path · required
string
max 200
campaignId
path · 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:write

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

name
optional
string
max 200
include_contacts
optional
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:run

active starts the account's send queue (with the configured delay), paused pauses it, done finishes the campaign.

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

status
required
"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:read

Parameters

accountId
path · required
string
max 200
campaignId
path · 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:write

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

contacts
required
object[]
max 5000 items
└contact_id
required
string
max 200
└display_name
optional
string
max 200
└phone
optional
string
max 30
└avatar
optional
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:write

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

contact_ids
optional
string[]
max 5000 items
all
optional
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:write

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

label_id
required
integer
≥ 1
only_users
optional
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:write

Same 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

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1

Request body (JSON)

group_id
required
string
max 200
exclude_ids
optional
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:read

Parameters

accountId
path · required
string
max 200
campaignId
path · required
integer
≥ 1
limit
query · 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:read

Parameters

accountId
path · required
string
max 200
Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID.
limit
query · 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:read

Parameters

accountId
path · 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"