API tạo Webhook
API này hỗ trợ Partner, Shop tạo các Webhook để nhận sự kiện trả về
A successful response
POST $BASE_URL.Webhook/CreateWebhook HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 38
{
"entities": [
"call_log"
],
"url": "text"
}A successful response
{
"created_at": "2025-12-06T02:23:38.038Z",
"entities": [
"call_log"
],
"fields": [
"text"
],
"id": "text",
"metadata": "text",
"states": {
"last_error": {
"error": "text",
"resp_body": "text",
"resp_status": 1,
"retried": 1,
"sent_at": "2025-12-06T02:23:38.038Z"
},
"last_sent_at": "2025-12-06T02:23:38.038Z",
"state": "text"
},
"url": "text"
}Request:
curl --location '$BASE_URL.Webhook/CreateWebhook' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
"entities": [
"call_log"
],
"url": "https://example.com/webhook"
}'Response:
{
"id": "1415096549774721835",
"entities": [
"call_log"
],
"fields": [],
"url": "https://example.com/webhook",
"metadata": "",
"created_at": "2025-09-25T03:50:25Z",
"states": {
"state": "ok",
"last_sent_at": null,
"last_error": null
}
}Tham số Request Body
url*
string
Địa chỉ endpoint nhận sự kiện
entities*
array of string
Danh sách loại sự kiện đăng ký, hiện tại chỉ hỗ trợ loại sự kiện:
call_log: Liên quan đến lịch sử cuộc gọi
zl_oa_message: Liên quan đến tin nhắn ZNS
Các trường trong Response
id
string
ID định danh duy nhất của webhook.
entities
array of string
Danh sách loại sự kiện mà webhook đăng ký (ví dụ: call_log,zl_oa_message).
fields
array
Danh sách các trường dữ liệu chi tiết (nếu có).
url
string
Địa chỉ endpoint webhook.
metadata
string
Thông tin metadata tùy chọn.
created_at
string
Thời gian webhook được tạo.
state
string
Trạng thái: "ok": Gửi thành công, webhook hoạt động bình thường "retry": Gửi thất bại và đang trong tiến trình retry theo backoff "stop": Đã vượt quá cấp retry cuối cùng, webhook bị vô hiệu hóa
last_sent_at
string
Thời điểm gần nhất hệ thống đã gửi event.
last_error
string
Thông tin lỗi gần nhất.
Last updated