Webhooks
此方法涉及设置和配置 webhook 以接收各种对话事件。这些事件包括来自用户的新消息以及有关外发消息状态的更新。
当发生 webhook 触发时,将向配置的 webhook URL 发送包含 JSON 负载的 POST 请求。
请确保您的应用程序对 webhook 做出 200 响应,以确保其正常运行。
此表列出了事件消息类型的所有可能选项。
| Type | Description |
|---|---|
MESSAGE_CREATED | New message received by our platform |
MESSAGE_DELIVERY | Delivery status updates of one message |
USER_EVENT | User related events like subscription |
TEMPLATE_STATUS_UPDATE | Template status updates |
TEMPLATE_CATEGORY_UPDATE | Template category updates |
消息发送状态
Conversations API 平台生成类型为 MESSAGE_DELIVERY 的事件通知,以提供先前发送消息的状态更新。
消息传递状态代码详述如下('status'参数)。
| Code | Description |
|---|---|
| DELIVERED | the message was delivered to the user |
| READ. | the message was read by the user |
| SENT | the message was sent to the provider |
| REJECTED | the message was rejected by our platform |
| FAILED | the message failed to be sent |
| EXPIRED | the message was not delivered in time |
| UNKNOWN | the message status is unknown |
In case of unsuccessful message deliveries, the platform will provide specific error codes ('errorCode' parameter) to indicate the cause of the failure.
| Code | Description |
|---|---|
| 1 | Unknown |
| 2 | User Not Subscribed |
| 3 | Price or Cost config Not Found |
| 4 | An error with your media. Could be an unsupported file format, etc |
| 5 | Free Test Quota Exceeded For Messages |
| 6 | Channel server unreachable |
| 7 | Monthly minimum fee not found |
| 8 | Template error |
| 9 | Quick Reply invalid item count, should be between 2 and 5 |
| 10 | Channel integration configuration not found |
| 11 | Overloaded |
| 12 | Your balance is not sufficient for this transaction |
| 13 | Route configuration not found |
| 14 | The business is not eligible or the template ID is not allowed for the business |
| 15 | Not found registered device for the phone number or message undeliverable due user preferences / legal reason |
| 16 | carrier network retry exceed |
| 17 | API Request rejected |
| 100 | User Not Found |
| 300 | Country not allowed |
| 301 | SMS request not success |
| 302 | App Route configuration not found |
| 303 | Channel is not activated |
用户事件
每当终端用户更改其订阅偏好时,我们的平台将推送一个类型为 USER_EVENT 的事件。
此表列出了事件消息类型的所有可能选项。
| Type | Description |
|---|---|
SUBSCRIBED | The user has subscribed |
UNSUBSCRIBED | The user has unsubscribed |
TAG_ASSIGN | User tag assignment has been updated |
错误
如果 webhook 请求未成功,系统将在 15 分钟内最多额外重试 3 次。
如果目标未返回成功代码(2XX)或不可解决的错误,每次重试之间的间隔将呈指数级增长。
此外,如果在20秒内没有收到响应,系统将视为失败并启动重试。
📄️ 创建一个 webhook
创建或更新 Webhook
📄️ 列出 Webhook
列出 Webhook