Bỏ qua tới nội dung

Danh bạ

Bạn bè, lời mời kết bạn, tra cứu người dùng. · 19 endpoint

Danh sách bạn bè (Zalo). refresh=true tải lại từ Zalo

GET/api/v1/accounts/{accountId}/friendsScope: contacts: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
refresh
query · tuỳ chọn
boolean
default false

Lệnh mẫu

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

Lời mời kết bạn đã nhận / đã gửi

GET/api/v1/accounts/{accountId}/friend-requestsScope: contacts: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.
direction
query · tuỳ chọn
"received" | "sent"
default "received"

Lệnh mẫu

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

Gửi lời mời kết bạn (Zalo)

POST/api/v1/accounts/{accountId}/friend-requestsScope: contacts: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)

user_id
bắt buộc
string
max 200
message
tuỳ chọn
string
max 150 · default ""

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/friend-requests" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"user_id":"string","message":""}'

Chấp nhận lời mời kết bạn

POST/api/v1/accounts/{accountId}/friend-requests/{userId}/acceptScope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/friend-requests/{userId}/accept" \
  -H "Authorization: Bearer dpk_xxx"

Từ chối lời mời kết bạn

POST/api/v1/accounts/{accountId}/friend-requests/{userId}/rejectScope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/friend-requests/{userId}/reject" \
  -H "Authorization: Bearer dpk_xxx"

Huỷ lời mời đã gửi

POST/api/v1/accounts/{accountId}/friend-requests/{userId}/cancelScope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/friend-requests/{userId}/cancel" \
  -H "Authorization: Bearer dpk_xxx"

Huỷ kết bạn (Zalo)

DELETE/api/v1/accounts/{accountId}/friends/{userId}Scope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

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

Tìm người dùng theo số điện thoại (DB trước, rồi Zalo)

GET/api/v1/accounts/{accountId}/users/lookupScope: contacts: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.
phone
query · bắt buộc
string
max 20

Lệnh mẫu

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

Hồ sơ người dùng từ Zalo

GET/api/v1/accounts/{accountId}/users/{userId}Scope: contacts:read

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

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

Nhóm chung với một người (Zalo)

GET/api/v1/accounts/{accountId}/users/{userId}/mutual-groupsScope: contacts:read

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/users/{userId}/mutual-groups" \
  -H "Authorization: Bearer dpk_xxx"

Chặn người dùng (Zalo, Facebook, Telegram)

POST/api/v1/accounts/{accountId}/users/{userId}/blockScope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/users/{userId}/block" \
  -H "Authorization: Bearer dpk_xxx"

Bỏ chặn người dùng

DELETE/api/v1/accounts/{accountId}/users/{userId}/blockScope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/users/{userId}/block" \
  -H "Authorization: Bearer dpk_xxx"

Đặt tên gợi nhớ (Zalo: đồng bộ lên Zalo; kênh khác: lưu trong Deplao)

PUT/api/v1/accounts/{accountId}/users/{userId}/aliasScope: contacts:write

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Body (JSON)

alias
bắt buộc
string
max 100
Chuỗi rỗng = xoá tên gợi nhớ

Lệnh mẫu

bash
curl -X PUT "http://127.0.0.1:9900/api/v1/accounts/{accountId}/users/{userId}/alias" \
  -H "Authorization: Bearer dpk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"alias":"string"}'

Tên gợi nhớ đã đặt trên Zalo

GET/api/v1/accounts/{accountId}/friend-aliasesScope: contacts: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.
page
query · tuỳ chọn
integer
≥ 1 · ≤ 1000 · default 1
count
query · tuỳ chọn
integer
≥ 1 · ≤ 500 · default 200

Lệnh mẫu

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

Gợi ý kết bạn và lời mời mới từ Zalo

GET/api/v1/accounts/{accountId}/friend-recommendationsScope: contacts:read

kind: request = người ta gửi lời mời cho bạn, suggestion = Zalo gợi ý.

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}/friend-recommendations" \
  -H "Authorization: Bearer dpk_xxx"

Trạng thái bạn bè với một người (Zalo)

GET/api/v1/accounts/{accountId}/users/{userId}/friend-statusScope: contacts:read

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng trên kênh

Lệnh mẫu

bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/users/{userId}/friend-status" \
  -H "Authorization: Bearer dpk_xxx"

Tìm liên hệ & nhóm đã lưu (không dấu: "duong" ra "Dương"), xếp theo độ khớp

GET/api/v1/accounts/{accountId}/contacts/searchScope: contacts: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.
q
query · tuỳ chọn
string
max 200 · default ""
type
query · tuỳ chọn
"all" | "user" | "group"
default "all"
limit
query · tuỳ chọn
integer
≥ 1 · ≤ 200 · default 50
offset
query · tuỳ chọn
integer
≥ 0 · default 0

Lệnh mẫu

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

Tra @username Telegram ra người dùng / nhóm

GET/api/v1/accounts/{accountId}/usernames/{username}Scope: contacts:read

Tham số

accountId
path · bắt buộc
string
max 200
username
path · bắt buộc
string
max 64
Có hoặc không có @

Lệnh mẫu

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

Trạng thái truy cập của một người (Zalo)

GET/api/v1/accounts/{accountId}/users/{userId}/presenceScope: contacts:read

status: online | offline (kèm last_seen_at, ms) | hidden (người đó ẩn trạng thái truy cập) | unknown. Kết quả đệm 60 giây cho mỗi người; refresh=true hỏi lại Zalo ngay.

Tham số

accountId
path · bắt buộc
string
max 200
userId
path · bắt buộc
string
max 200
ID người dùng Zalo
refresh
query · tuỳ chọn
booleanBỏ qua đệm 60 giây

Lệnh mẫu

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