跳到主要内容

Webhooks

此方法涉及设置和配置 webhook 以接收各种对话事件。这些事件包括来自用户的新消息以及有关外发消息状态的更新。

当发生 webhook 触发时,将向配置的 webhook URL 发送包含 JSON 负载的 POST 请求。

请确保您的应用程序对 webhook 做出 200 响应,以确保其正常运行。

此表列出了事件消息类型的所有可能选项。

TypeDescription
MESSAGE_CREATEDNew message received by our platform
MESSAGE_DELIVERYDelivery status updates of one message
USER_EVENTUser related events like subscription
TEMPLATE_STATUS_UPDATETemplate status updates
TEMPLATE_CATEGORY_UPDATETemplate category updates

消息发送状态

Conversations API 平台生成类型为 MESSAGE_DELIVERY 的事件通知,以提供先前发送消息的状态更新。

消息传递状态代码详述如下('status'参数)。

CodeDescription
DELIVEREDthe message was delivered to the user
READ.the message was read by the user
SENTthe message was sent to the provider
REJECTEDthe message was rejected by our platform
FAILEDthe message failed to be sent
EXPIREDthe message was not delivered in time
UNKNOWNthe 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.

CodeDescription
1Unknown
2User Not Subscribed
3Price or Cost config Not Found
4An error with your media. Could be an unsupported file format, etc
5Free Test Quota Exceeded For Messages
6Channel server unreachable
7Monthly minimum fee not found
8Template error
9Quick Reply invalid item count, should be between 2 and 5
10Channel integration configuration not found
11Overloaded
12Your balance is not sufficient for this transaction
13Route configuration not found
14The business is not eligible or the template ID is not allowed for the business
15Not found registered device for the phone number or message undeliverable due user preferences / legal reason
16carrier network retry exceed
17API Request rejected
100User Not Found
300Country not allowed
301SMS request not success
302App Route configuration not found
303Channel is not activated

用户事件

每当终端用户更改其订阅偏好时,我们的平台将推送一个类型为 USER_EVENT 的事件。

此表列出了事件消息类型的所有可能选项。

TypeDescription
SUBSCRIBEDThe user has subscribed
UNSUBSCRIBEDThe user has unsubscribed
TAG_ASSIGNUser tag assignment has been updated

错误

如果 webhook 请求未成功,系统将在 15 分钟内最多额外重试 3 次。

如果目标未返回成功代码(2XX)或不可解决的错误,每次重试之间的间隔将呈指数级增长。

此外,如果在20秒内没有收到响应,系统将视为失败并启动重试。