建立 Webhook 端點
建立 Webhook 接收端。url 一定要係絕對 HTTP(S) URL,正式環境建議 HTTPS;status 淨係可以係 active / inactive。subscribed_events 接受公開事件或 ["*"],max_attempts 範圍 0..5。
https://api.unifyport.ai/v1/webhook-endpoints請求標頭
X-Api-Key工作區 API Key,工作區會由呢個標頭解析得出嚟。
Content-Type發送 JSON 請求內容嘅時候請用 application/json。
路徑參數
呢個介面冇路徑參數。
請求內容
url接收 Webhook 嘅絕對 HTTP(S) URL;正式環境建議 HTTPS。
format: uri
status端點狀態:active 或 inactive。
enum: active, inactive
subscribed_events[]推送到呢個端點嘅公開標準事件;["*"] 代表全部公開事件,唔包括 provider.raw_event。
signing_secret可選嘅 Webhook 簽名密鑰,例子入面請用佔位符。
retry_policyobject可選嘅重試政策。max_attempts 係首次投遞之後嘅重試次數,預設 3,範圍 0 到 5;0 代表只做首次投遞。
retry_policy可選嘅重試政策。max_attempts 係首次投遞之後嘅重試次數,預設 3,範圍 0 到 5;0 代表只做首次投遞。
max_attempts首次投遞之後嘅重試次數,範圍係 0 到 5。
回應內容
idWebhook 端點識別碼(we_...)。
url接收 webhook 派送嘅絕對 HTTP(S) URL;正式環境建議 HTTPS。
format: uri
status端點狀態:active 或者 inactive。
enum: active, inactive
subscribed_events[]派去呢個端點嘅公開標準事件類型;["*"] 即係全部公開事件,唔包括 provider.raw_event。
signing_enabled設咗簽名密鑰、派送會簽名嗰陣會係 true。
retry_policyobjectAPI 回傳嘅重試設定。max_attempts 統計首次投遞之後嘅重試次數,預設 3,範圍 0 到 5。
retry_policyAPI 回傳嘅重試設定。max_attempts 統計首次投遞之後嘅重試次數,預設 3,範圍 0 到 5。
max_attempts已設定嘅首次投遞後重試次數,範圍係 0 到 5。
回應
201請求成功,回應內容嘅例子如上。
400請求內容、路徑或者參數無效。
401X-Api-Key 請求標頭缺少或者無效。
請求
curl -X POST https://api.unifyport.ai/v1/webhook-endpoints \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhook",
"status": "active",
"subscribed_events": ["*"],
"signing_secret": "<WEBHOOK_SIGNING_SECRET>"
}'回應
{
"data": {
"id": "we_example",
"url": "https://example.com/webhook",
"status": "active",
"subscribed_events": ["*"],
"signing_enabled": true,
"retry_policy": {
"max_attempts": 3
}
}
}