Chiến dịch
· 15 endpoint
- 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
Chiến dịch của tài khoản
GET
/api/v1/accounts/{accountId}/campaignsScope: crm:readTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns" \
-H "Authorization: Bearer dpk_xxx"Tạo chiến dịch (trạng thái draft)
POST
/api/v1/accounts/{accountId}/campaignsScope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
Body (JSON)
namebắt buộc | string max 200 | |
campaign_typetuỳ chọn | "message" | "friend_request" | "mixed" default "message" | |
template_messagetuỳ chọn | string | object default "" | Nội dung gửi; hỗ trợ biến như UI ({name}...) hoặc JSON blocks của trình soạn |
friend_request_messagetuỳ chọn | string max 500 · default "" | |
mixed_configtuỳ chọn | string | object | |
delay_secondstuỳ chọn | integer ≥ 5 · ≤ 86400 · default 60 | Giãn cách giữa 2 liên hệ (giây); hàng đợi luôn chờ tối thiểu 30 giây |
Lệnh mẫu
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":""}'Một chiến dịch
GET
/api/v1/accounts/{accountId}/campaigns/{campaignId}Scope: crm:readTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}" \
-H "Authorization: Bearer dpk_xxx"Sửa chiến dịch
PATCH
/api/v1/accounts/{accountId}/campaigns/{campaignId}Scope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
nametuỳ chọn | string max 200 | |
campaign_typetuỳ chọn | "message" | "friend_request" | "mixed" default "message" | |
template_messagetuỳ chọn | string | object default "" | Nội dung gửi; hỗ trợ biến như UI ({name}...) hoặc JSON blocks của trình soạn |
friend_request_messagetuỳ chọn | string max 500 · default "" | |
mixed_configtuỳ chọn | string | object | |
delay_secondstuỳ chọn | integer ≥ 5 · ≤ 86400 · default 60 | Giãn cách giữa 2 liên hệ (giây); hàng đợi luôn chờ tối thiểu 30 giây |
Lệnh mẫu
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":""}'Xoá chiến dịch
DELETE
/api/v1/accounts/{accountId}/campaigns/{campaignId}Scope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}" \
-H "Authorization: Bearer dpk_xxx"Nhân bản chiến dịch
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/cloneScope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
nametuỳ chọn | string max 200 | |
include_contactstuỳ chọn | boolean default false |
Lệnh mẫu
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}'Chạy / tạm dừng / kết thúc chiến dịch
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/statusScope: campaigns:runactive bắt đầu hàng đợi gửi theo tài khoản (giãn cách như cấu hình), paused tạm dừng, done kết thúc.
Tham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
statusbắt buộc | "draft" | "active" | "paused" | "done" |
Lệnh mẫu
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"}'Người nhận của chiến dịch và trạng thái gửi
GET
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contactsScope: crm:readTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts" \
-H "Authorization: Bearer dpk_xxx"Thêm người nhận vào chiến dịch
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contactsScope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
contactsbắt buộc | object[] max 5000 items | |
└contact_idbắt buộc | string max 200 | |
└display_nametuỳ chọn | string max 200 | |
└phonetuỳ chọn | string max 30 | |
└avatartuỳ chọn | string max 1000 |
Lệnh mẫu
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":[]}'Xoá người nhận (theo danh sách hoặc tất cả)
DELETE
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contactsScope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
contact_idstuỳ chọn | string[] max 5000 items | |
alltuỳ chọn | boolean default false |
Lệnh mẫu
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}'Thêm mọi hội thoại đang gắn một nhãn vào chiến dịch
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts/from-labelScope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
label_idbắt buộc | integer ≥ 1 | |
only_userstuỳ chọn | boolean default true | Bỏ qua nhóm chat |
Lệnh mẫu
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}'Thêm thành viên một nhóm (đã quét/lưu) vào chiến dịch
POST
/api/v1/accounts/{accountId}/campaigns/{campaignId}/contacts/from-groupScope: crm:writeNhư "Thêm vào chiến dịch" ở tab Thành viên nhóm. Thành viên lấy từ danh sách đã lưu (quét nhóm trong app trước nếu trống).
Tham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 |
Body (JSON)
group_idbắt buộc | string max 200 | |
exclude_idstuỳ chọn | string[] max 5000 items · default [] |
Lệnh mẫu
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":[]}'Nhật ký gửi của chiến dịch
GET
/api/v1/accounts/{accountId}/campaigns/{campaignId}/send-logScope: crm:readTham số
accountIdpath · bắt buộc | string max 200 | |
campaignIdpath · bắt buộc | integer ≥ 1 | |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 1000 · default 200 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns/{campaignId}/send-log" \
-H "Authorization: Bearer dpk_xxx"Thống kê chiến dịch nổi bật
GET
/api/v1/accounts/{accountId}/campaigns-statsScope: crm:readTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 100 · default 10 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns-stats" \
-H "Authorization: Bearer dpk_xxx"Trạng thái hàng đợi gửi chiến dịch
GET
/api/v1/accounts/{accountId}/campaigns-queueScope: crm:readTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/campaigns-queue" \
-H "Authorization: Bearer dpk_xxx"