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