API tạo Webhook

API này hỗ trợ Partner, Shop tạo các Webhook để nhận sự kiện trả về

Lưu ý:

  • Đối với các API sử dụng cho Shop thì API_KEY: <api_key>. Thông tin base_url của Shop

  • Đối với các API sử dụng cho Partner thì API_KEY: <api_key> - Đây là api_key của chính Partner. Thông tin base_url của Partner

CreateWebhook

post
Body
urlstringRequired
Responses
200

A successful response

application/json
post
POST $BASE_URL.Webhook/CreateWebhook HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 38

{
  "entities": [
    "call_log"
  ],
  "url": "text"
}
200

A successful response

{
  "created_at": "2025-10-15T03:52:26.117Z",
  "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-10-15T03:52:26.117Z"
    },
    "last_sent_at": "2025-10-15T03:52:26.117Z",
    "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

Tên trường
Kiểu dữ liệu
Mô tả

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".

Các trường trong Response

Tên trường
Kiểu dữ liệu
Mô tả

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).

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