Sự kiện người dùng nhận tin nhắn
Khi gửi tin nhắn cho người dùng và tin nhắn đã đến thiết bị người dùng, hệ thống InfiniX sẽ gửi đến Webhook URL của ứng dụng một HTTP request như sau
URL: Webhook URL của ứng dụng
Method: POST
Content Type: application/json
x-validate-key: "Key webhook trên portal"
Example request body
Example ZNS Webhook
{
"messageType": "zns",
"sessionId": "1c62e4dc-c959-478d-a5f4-3434bf5ad608",
"trackingId": "0000f9b5-1aa9-4cdc-b162-b2afc74ef241",
"znsInfo": {
"phone": "8436365****",
"status": "RECEIVED",
"type": "NORMAL",
"createdAt": "2024-10-08T02:51:29.933Z",
"error": null
}
}Example SMS Webhook
{
"messageType": "sms",
"sessionId": "1c62e4dc-c959-478d-a5f4-3434bf5ad608",
"trackingId": "0000f9b5-1aa9-4cdc-b162-b2afc74ef241",
"smsInfo": {
"phone": "8436365****",
"status": "RECEIVED",
"createdAt": "2024-10-08T02:51:29.933Z",
"error": null
}
}Cấu trúc thuộc tính
messageType
string
Loại webhook tin nhắn. Gồm 2 loại là: - zns - sms
sessionId
string
Mỗi request sẽ sinh ra 1 sessionId để nhận diện
trackingId
string
ID tuỳ chỉnh từ phía đối tác để theo dõi tin nhắn. Nếu như đối tác không truyền trackingId, hệ thống InfiniX sẽ tự sinh ra một trackingId Lưu ý: Chỉ hỗ trợ UUID hoặc MongoDB ObjectId
phone
string
Số điện thoại người nhận
status
string
Trạng thái tin nhắn
type
string
Loại tin ZNS
createdAt
Date
Thời gian khởi tạo tin
error
string
Hiển thị message lỗi khi có lỗi xảy ra
Last updated