Bỏ qua tới nội dung

CRM

Khách hàng, tag CRM, ghi chú, chiến dịch gửi tin. · 13 endpoint

Khách hàng (bạn bè, người lạ, nhóm) với bộ lọc như trang CRM

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

Tham số

accountId
path · 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.
limit
query · tuỳ chọn
integer
≥ 1 · ≤ 200 · default 50
Số bản ghi tối đa (1–200)
offset
query · tuỳ chọn
integer
≥ 0 · default 0
Bỏ qua N bản ghi đầu
search
query · tuỳ chọn
string
max 200
type
query · tuỳ chọn
"all" | "friend" | "non_friend" | "group"
default "all"
sort_by
query · tuỳ chọn
"name" | "last_message"
default "last_message"
sort_dir
query · tuỳ chọn
"asc" | "desc"
default "desc"

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/contacts" \
  -H "Authorization: Bearer dpk_xxx"

Thống kê khách hàng (tổng, bạn bè, ghi chú)

GET/api/v1/accounts/{accountId}/crm/contacts/statsScope: crm:read

Tham số

accountId
path · 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}/crm/contacts/stats" \
  -H "Authorization: Bearer dpk_xxx"

Hồ sơ khách: thông tin, nhãn, ghi chú, 5 tin gần nhất

GET/api/v1/accounts/{accountId}/crm/contacts/{contactId}Scope: crm:read

Tham số

accountId
path · bắt buộc
string
max 200
contactId
path · bắt buộc
string
max 200

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/contacts/{contactId}" \
  -H "Authorization: Bearer dpk_xxx"

Cập nhật số điện thoại / tên hiển thị / biệt danh (lưu trên Deplao)

PATCH/api/v1/accounts/{accountId}/crm/contacts/{contactId}Scope: crm:write

Tham số

accountId
path · bắt buộc
string
max 200
contactId
path · bắt buộc
string
max 200

Body (JSON)

phone
tuỳ chọn
string
max 30
display_name
tuỳ chọn
string
max 200
alias
tuỳ chọn
string
max 100

Lệnh mẫu

bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/contacts/{contactId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"phone":"string","display_name":"string","alias":"string"}'

Ghi chú của khách

GET/api/v1/accounts/{accountId}/crm/contacts/{contactId}/notesScope: crm:read

Tham số

accountId
path · bắt buộc
string
max 200
contactId
path · bắt buộc
string
max 200

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/contacts/{contactId}/notes" \
  -H "Authorization: Bearer dpk_xxx"

Thêm ghi chú

POST/api/v1/accounts/{accountId}/crm/contacts/{contactId}/notesScope: crm:write

Tham số

accountId
path · bắt buộc
string
max 200
contactId
path · bắt buộc
string
max 200

Body (JSON)

content
bắt buộc
string
max 10000
topic_id
tuỳ chọn
string

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/contacts/{contactId}/notes" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"content":"string","topic_id":"string"}'

Sửa ghi chú

PATCH/api/v1/accounts/{accountId}/crm/notes/{noteId}Scope: crm:write

Tham số

accountId
path · bắt buộc
string
max 200
noteId
path · bắt buộc
integer
≥ 1

Body (JSON)

contact_id
bắt buộc
string
max 200
content
bắt buộc
string
max 10000

Lệnh mẫu

bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/notes/{noteId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"contact_id":"string","content":"string"}'

Xoá ghi chú

DELETE/api/v1/accounts/{accountId}/crm/notes/{noteId}Scope: crm:write

Tham số

accountId
path · bắt buộc
string
max 200
noteId
path · bắt buộc
integer
≥ 1

Lệnh mẫu

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/notes/{noteId}" \
  -H "Authorization: Bearer dpk_xxx"

Hoạt động CRM trong khoảng thời gian

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

Tham số

accountId
path · 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.
since
query · bắt buộc
integer
≥ 0
Epoch ms
until
query · tuỳ chọn
integer
≥ 0

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/crm/activity" \
  -H "Authorization: Bearer dpk_xxx"

Thẻ ngân hàng đã lưu để gửi cho khách

GET/api/v1/accounts/{accountId}/bank-cardsScope: crm:read

Tham số

accountId
path · 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}/bank-cards" \
  -H "Authorization: Bearer dpk_xxx"

Lưu thẻ ngân hàng (để gửi nhanh cho khách)

POST/api/v1/accounts/{accountId}/bank-cardsScope: crm:write

Tham số

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

bank_name
bắt buộc
string
max 100
bin_bank
bắt buộc
integer
≥ 100000 · ≤ 999999
Mã BIN ngân hàng (6 số, vd 970436 = Vietcombank)
account_number
bắt buộc
string
max 40
account_name
bắt buộc
string
max 100
is_default
tuỳ chọn
boolean
default false

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/bank-cards" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"bank_name":"Vietcombank","bin_bank":970436,"account_number":"0011001234567","account_name":"NGUYEN VAN A","is_default":true}'

Sửa thẻ ngân hàng

PATCH/api/v1/accounts/{accountId}/bank-cards/{cardId}Scope: crm:write

Tham số

accountId
path · bắt buộc
string
max 200
cardId
path · bắt buộc
integer
≥ 1

Body (JSON)

bank_name
tuỳ chọn
string
max 100
bin_bank
tuỳ chọn
integer
≥ 100000 · ≤ 999999
account_number
tuỳ chọn
string
max 40
account_name
tuỳ chọn
string
max 100
is_default
tuỳ chọn
boolean

Lệnh mẫu

bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/bank-cards/{cardId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"bank_name":"string","bin_bank":100000,"account_number":"string"}'

Xoá thẻ ngân hàng đã lưu

DELETE/api/v1/accounts/{accountId}/bank-cards/{cardId}Scope: crm:write

Tham số

accountId
path · bắt buộc
string
max 200
cardId
path · bắt buộc
integer
≥ 1

Lệnh mẫu

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/bank-cards/{cardId}" \
  -H "Authorization: Bearer dpk_xxx"