Bỏ qua tới nội dung

Nhãn & tin nhanh

Nhãn hội thoại (local), tin nhắn nhanh, sticker. · 30 endpoint

Nhãn (local) dùng được ở tài khoản

GET/api/v1/accounts/{accountId}/labelsScope: chat: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}/labels" \
  -H "Authorization: Bearer dpk_xxx"

Tạo nhãn

POST/api/v1/labelsScope: chat:manage

Body (JSON)

name
bắt buộc
string
max 100
color
tuỳ chọn
string
max 20 · default "#3B82F6"
text_color
tuỳ chọn
string
max 20 · default "#FFFFFF"
emoji
tuỳ chọn
string
max 16 · default "🏷️"
account_ids
tuỳ chọn
string[]
max 200 items
Chỉ hiện ở các tài khoản này; bỏ trống = mọi tài khoản
shortcut
tuỳ chọn
string
max 20

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/labels" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","color":"#3B82F6","text_color":"#FFFFFF"}'

Sửa nhãn

PATCH/api/v1/labels/{labelId}Scope: chat:manage

Tham số

labelId
path · bắt buộc
integer
≥ 1

Body (JSON)

name
tuỳ chọn
string
max 100
color
tuỳ chọn
string
max 20 · default "#3B82F6"
text_color
tuỳ chọn
string
max 20 · default "#FFFFFF"
emoji
tuỳ chọn
string
max 16 · default "🏷️"
account_ids
tuỳ chọn
string[]
max 200 items
Chỉ hiện ở các tài khoản này; bỏ trống = mọi tài khoản
shortcut
tuỳ chọn
string
max 20

Lệnh mẫu

bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/labels/{labelId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","color":"#3B82F6","text_color":"#FFFFFF"}'

Xoá nhãn (gỡ khỏi mọi hội thoại)

DELETE/api/v1/labels/{labelId}Scope: chat:manage

Tham số

labelId
path · bắt buộc
integer
≥ 1

Lệnh mẫu

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/labels/{labelId}" \
  -H "Authorization: Bearer dpk_xxx"

Nhãn đang gán cho hội thoại

GET/api/v1/accounts/{accountId}/conversations/{threadId}/labelsScope: chat:read

Tham số

accountId
path · bắt buộc
string
max 200
ID tài khoản
threadId
path · bắt buộc
string
max 200
ID hội thoại (user id hoặc group id của kênh)

Lệnh mẫu

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

Đặt đúng tập nhãn cho hội thoại (gán thiếu, gỡ thừa)

PUT/api/v1/accounts/{accountId}/conversations/{threadId}/labelsScope: chat:manage

Mỗi lần gán/gỡ đi qua cùng handler UI dùng nên workflow "Khi gán hoặc gỡ nhãn" vẫn chạy.

Tham số

accountId
path · bắt buộc
string
max 200
ID tài khoản
threadId
path · bắt buộc
string
max 200
ID hội thoại (user id hoặc group id của kênh)

Body (JSON)

label_ids
bắt buộc
integer[]
max 100 items

Lệnh mẫu

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/accounts/{accountId}/conversations/{threadId}/labels" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"label_ids":[]}'

Gán một nhãn cho hội thoại

POST/api/v1/accounts/{accountId}/conversations/{threadId}/labels/{labelId}Scope: chat:manage

Tham số

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

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/conversations/{threadId}/labels/{labelId}" \
  -H "Authorization: Bearer dpk_xxx"

Gỡ một nhãn khỏi hội thoại

DELETE/api/v1/accounts/{accountId}/conversations/{threadId}/labels/{labelId}Scope: chat:manage

Tham số

accountId
path · bắt buộc
string
max 200
threadId
path · bắt buộc
string
max 200
labelId
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}/conversations/{threadId}/labels/{labelId}" \
  -H "Authorization: Bearer dpk_xxx"

Nhãn trên server Zalo của tài khoản (chỉ Zalo, cần online)

GET/api/v1/accounts/{accountId}/zalo-labelsScope: chat: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}/zalo-labels" \
  -H "Authorization: Bearer dpk_xxx"

Tin nhắn nhanh (/keyword) của tài khoản

GET/api/v1/accounts/{accountId}/quick-messagesScope: chat: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}/quick-messages" \
  -H "Authorization: Bearer dpk_xxx"

Tạo hoặc cập nhật tin nhắn nhanh (theo keyword)

POST/api/v1/accounts/{accountId}/quick-messagesScope: chat:manage

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)

keyword
bắt buộc
string
max 50
title
bắt buộc
string
max 5000
media
tuỳ chọn
anyGiữ nguyên định dạng media của app (tuỳ chọn)

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/quick-messages" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"keyword":"string","title":"string","media":null}'

Xoá tin nhắn nhanh

DELETE/api/v1/accounts/{accountId}/quick-messages/{id}Scope: chat:manage

Tham số

accountId
path · bắt buộc
string
max 200
id
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}/quick-messages/{id}" \
  -H "Authorization: Bearer dpk_xxx"

Sticker dùng gần đây

GET/api/v1/stickers/recentScope: chat:read

Tham số

limit
query · tuỳ chọn
integer
≥ 1 · ≤ 100 · default 30

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/stickers/recent" \
  -H "Authorization: Bearer dpk_xxx"

Bộ sticker đã lưu

GET/api/v1/sticker-packsScope: chat:read

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/sticker-packs" \
  -H "Authorization: Bearer dpk_xxx"

Sticker trong một bộ

GET/api/v1/sticker-packs/{catId}/stickersScope: chat:read

Tham số

catId
path · bắt buộc
integer

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/sticker-packs/{catId}/stickers" \
  -H "Authorization: Bearer dpk_xxx"

ID sticker theo từ khoá (đã cache)

GET/api/v1/stickers/searchScope: chat:read

Tham số

keyword
query · bắt buộc
string
max 50

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/stickers/search" \
  -H "Authorization: Bearer dpk_xxx"

Hội thoại đang gắn một nhãn

GET/api/v1/accounts/{accountId}/labels/{labelId}/conversationsScope: chat:read

Tham số

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

Lệnh mẫu

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

Gán nhiều nhãn cho nhiều hội thoại trong một lần

POST/api/v1/accounts/{accountId}/labels/bulk-assignScope: chat:manage

Một transaction như thao tác gán hàng loạt trong app. Khác gán từng nhãn: không bắn workflow "Khi gán nhãn".

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)

label_ids
bắt buộc
integer[]
max 50 items
thread_ids
bắt buộc
string[]
max 1000 items

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/labels/bulk-assign" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"label_ids":[],"thread_ids":[]}'

Sắp xếp thứ tự nhãn (theo mảng id)

PUT/api/v1/labels/orderScope: chat:manage

Body (JSON)

label_ids
bắt buộc
integer[]
max 300 items

Lệnh mẫu

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/labels/order" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"label_ids":[]}'

Bật / ẩn nhãn

PUT/api/v1/labels/{labelId}/activeScope: chat:manage

Tham số

labelId
path · bắt buộc
integer
≥ 1

Body (JSON)

active
bắt buộc
boolean

Lệnh mẫu

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/labels/{labelId}/active" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"active":false}'

Sao chép bộ nhãn của tài khoản này sang tài khoản khác

POST/api/v1/labels/cloneScope: chat:manage

Body (JSON)

from_account_id
bắt buộc
string
max 200
to_account_id
bắt buộc
string
max 200

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/labels/clone" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"from_account_id":"string","to_account_id":"string"}'

Gắn nhãn Zalo cho hội thoại (mỗi hội thoại một nhãn)

POST/api/v1/accounts/{accountId}/zalo-labels/{labelId}/conversations/{threadId}Scope: chat:manage

Đồng bộ lên Zalo (hiện trên điện thoại). Gắn nhãn mới sẽ gỡ nhãn Zalo cũ của hội thoại như trong app; workflow "Khi gán hoặc gỡ nhãn" vẫn chạy.

Tham số

accountId
path · bắt buộc
string
max 200
labelId
path · bắt buộc
integer
≥ 0
threadId
path · bắt buộc
string
max 200

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo-labels/{labelId}/conversations/{threadId}" \
  -H "Authorization: Bearer dpk_xxx"

Gỡ nhãn Zalo khỏi hội thoại

DELETE/api/v1/accounts/{accountId}/zalo-labels/{labelId}/conversations/{threadId}Scope: chat:manage

Đồng bộ lên Zalo (hiện trên điện thoại). Gắn nhãn mới sẽ gỡ nhãn Zalo cũ của hội thoại như trong app; workflow "Khi gán hoặc gỡ nhãn" vẫn chạy.

Tham số

accountId
path · bắt buộc
string
max 200
labelId
path · bắt buộc
integer
≥ 0
threadId
path · bắt buộc
string
max 200

Lệnh mẫu

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo-labels/{labelId}/conversations/{threadId}" \
  -H "Authorization: Bearer dpk_xxx"

Sắp xếp thứ tự tin nhắn nhanh

PUT/api/v1/accounts/{accountId}/quick-messages/orderScope: chat:manage

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)

ids
bắt buộc
integer[]
max 300 items

Lệnh mẫu

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/accounts/{accountId}/quick-messages/order" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"ids":[]}'

Bật / tắt một tin nhắn nhanh

PUT/api/v1/accounts/{accountId}/quick-messages/{id}/activeScope: chat:manage

Tham số

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

Body (JSON)

active
bắt buộc
boolean

Lệnh mẫu

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/accounts/{accountId}/quick-messages/{id}/active" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"active":false}'

Sao chép tin nhắn nhanh sang tài khoản khác

POST/api/v1/accounts/{accountId}/quick-messages/cloneScope: chat:manage

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)

to_account_id
bắt buộc
string
max 200

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/quick-messages/clone" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"to_account_id":"string"}'

Tin nhắn nhanh lưu trên Zalo (dùng được cả trên điện thoại)

GET/api/v1/accounts/{accountId}/zalo-quick-messagesScope: chat: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}/zalo-quick-messages" \
  -H "Authorization: Bearer dpk_xxx"

Tạo tin nhắn nhanh trên Zalo

POST/api/v1/accounts/{accountId}/zalo-quick-messagesScope: chat:manage

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)

keyword
bắt buộc
string
max 50
title
bắt buộc
string
max 5000

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo-quick-messages" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"keyword":"string","title":"string"}'

Sửa tin nhắn nhanh trên Zalo

PATCH/api/v1/accounts/{accountId}/zalo-quick-messages/{itemId}Scope: chat:manage

Tham số

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

Body (JSON)

keyword
bắt buộc
string
max 50
title
bắt buộc
string
max 5000

Lệnh mẫu

bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo-quick-messages/{itemId}" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"keyword":"string","title":"string"}'

Xoá tin nhắn nhanh trên Zalo

DELETE/api/v1/accounts/{accountId}/zalo-quick-messages/{itemId}Scope: chat:manage

Tham số

accountId
path · bắt buộc
string
max 200
itemId
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}/zalo-quick-messages/{itemId}" \
  -H "Authorization: Bearer dpk_xxx"