跳到主要內容

重投一則投遞

POST/v1/webhook-endpoints/{id}/deliveries/{deliveryId}/redeliver

重新傳送一筆已結束(delivered 或 failed)的投遞。會建立並回傳一筆投遞紀錄,原紀錄保留。

驗證

請求標頭需攜帶 Authorization: Bearer <API_KEY>。API Key 可存取的資源由目前授權範圍決定。

請求​

Base URL:https://api.bluehola.com

參數​

名稱位置必填類型/約束說明
idpath是string回呼端點 ID,whe_...
deliveryIdpath是string要重新傳送的投遞,wd_...,從查看投遞紀錄取得

無請求主體。

回應​

狀態碼說明
202已受理——新投遞已排入佇列
4xx用戶端錯誤

202 回應 Schema​

新的投遞紀錄,形狀與查看投遞紀錄的一筆 item 相同;其 redeliveredFrom 為原投遞的 ID。

{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"endpointId": {
"type": "string"
},
"eventId": {
"type": [
"string",
"null"
]
},
"eventType": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"pending",
"queued",
"delivered",
"failed"
]
},
"attempts": {
"type": "integer"
},
"responseStatus": {
"type": [
"integer",
"null"
]
},
"responseBodyPreview": {
"type": [
"string",
"null"
]
},
"lastError": {
"type": [
"string",
"null"
]
},
"nextRetryAt": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"redeliveredFrom": {
"type": [
"string",
"null"
]
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"completedAt": {
"type": [
"string",
"null"
],
"format": "date-time"
}
}
}

通用錯誤信封及處理建議見錯誤碼。

錯誤​

狀態碼details.reason含義
409delivery_in_progress原投遞尚未結束(pending / queued),它會自己繼續重試
409endpoint_not_active端點不是 active;請先重新啟用或完成驗證
409redelivery_in_progress同一事件已有一次進行中的重投
404—該投遞不屬於路徑中的端點

補充說明​

用於找回接收端故障期間錯過的事件——自動重試約 38.6 小時後會放棄(見 Webhook 整合)。202 只表示重投已排入佇列,結果請在查看投遞紀錄中確認。

  • 重投送往端點目前的 URL,並用目前的金鑰簽名,所以輪替金鑰之後也能通過驗簽。
  • 去重: 連接協議下,重投與原投遞攜帶相同的 Webhook-Id,接收方可以據此去重。預設方案下 X-Delivery-Id 是新投遞的 ID;如果重投的事件可能已經被接收方處理過,請依事件內容去重(例如訊息的 id / wamid)。
  • 原投遞紀錄不會被修改。