Danh bạ
Bạn bè, lời mời kết bạn, tra cứu người dùng. · 19 endpoint
- GET/accounts/{accountId}/friends
- GET/accounts/{accountId}/friend-requests
- POST/accounts/{accountId}/friend-requests
- POST/accounts/{accountId}/friend-requests/{userId}/accept
- POST/accounts/{accountId}/friend-requests/{userId}/reject
- POST/accounts/{accountId}/friend-requests/{userId}/cancel
- DELETE/accounts/{accountId}/friends/{userId}
- GET/accounts/{accountId}/users/lookup
- GET/accounts/{accountId}/users/{userId}
- GET/accounts/{accountId}/users/{userId}/mutual-groups
- POST/accounts/{accountId}/users/{userId}/block
- DELETE/accounts/{accountId}/users/{userId}/block
- PUT/accounts/{accountId}/users/{userId}/alias
- GET/accounts/{accountId}/friend-aliases
- GET/accounts/{accountId}/friend-recommendations
- GET/accounts/{accountId}/users/{userId}/friend-status
- GET/accounts/{accountId}/contacts/search
- GET/accounts/{accountId}/usernames/{username}
- GET/accounts/{accountId}/users/{userId}/presence
Danh sách bạn bè (Zalo). refresh=true tải lại từ Zalo
GET
/api/v1/accounts/{accountId}/friendsScope: contacts: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 · ≤ 200 · default 50 | Số bản ghi tối đa (1–200) |
offsetquery · tuỳ chọn | integer ≥ 0 · default 0 | Bỏ qua N bản ghi đầu |
searchquery · tuỳ chọn | string max 200 | |
refreshquery · 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: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. |
directionquery · 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: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)
user_idbắt buộc | string max 200 | |
messagetuỳ 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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: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. |
phonequery · 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:readTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:readTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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:writeTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · bắt buộc | string max 200 | ID người dùng trên kênh |
Body (JSON)
aliasbắ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: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. |
pagequery · tuỳ chọn | integer ≥ 1 · ≤ 1000 · default 1 | |
countquery · 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:readkind: request = người ta gửi lời mời cho bạn, suggestion = Zalo gợi ý.
Tham 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}/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:readTham số
accountIdpath · bắt buộc | string max 200 | |
userIdpath · 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: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. |
qquery · tuỳ chọn | string max 200 · default "" | |
typequery · tuỳ chọn | "all" | "user" | "group" default "all" | |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 200 · default 50 | |
offsetquery · 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:readTham số
accountIdpath · bắt buộc | string max 200 | |
usernamepath · 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:readstatus: 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ố
accountIdpath · bắt buộc | string max 200 | |
userIdpath · bắt buộc | string max 200 | ID người dùng Zalo |
refreshquery · tuỳ chọn | boolean | Bỏ 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"