Webhook
对时间戳、一个句点和精确的原始请求体验证签名。保存事件 ID 以忽略重复投递。重试投递不会重新生成。
添加 Webhook#
curl -X POST 'https://platform.tongai.io/v1/webhook-endpoints' \ -H "Authorization: Bearer $TONG_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 45be69f1-c266-4a09-a82c-bf3c6303eb03" \ -d '{ "url": "https://your-app.example/tong/events", "events": [ "operation.succeeded", "operation.failed", "operation.review_required", "usage.settled" ]}'配置
curl --version请选择具有 webhooks:manage 和 operations:read 权限的密钥或连接。
验证签名#
Tong-Event-Id: {event_uuid}Tong-Timestamp: {unix_seconds}Tong-Key-Version: 1Tong-Signature: v1={hex_hmac_sha256}
HMAC_SHA256(signing_secret, timestamp + "." + raw_body)投递历史#
POST /v1/webhook-endpoints/{id}/rotate-secretGET /v1/webhook-endpoints/{id}/deliveriesPOST /v1/webhook-endpoints/{id}/deliveries/{delivery_id}/retryGET /v1/webhook-endpoints读取所选自有资源或当前工作流状态,不启动新的生成任务。POST /v1/webhook-endpoints使用此 HTTP 端点文档列出的请求字段和权限。PATCH /v1/webhook-endpoints/{id}使用此 HTTP 端点文档列出的请求字段和权限。POST /v1/webhook-endpoints/{id}/rotate-secret使用此 HTTP 端点文档列出的请求字段和权限。GET /v1/webhook-endpoints/{id}/deliveries读取所选自有资源或当前工作流状态,不启动新的生成任务。POST /v1/webhook-endpoints/{id}/deliveries/{delivery_id}/retry使用此 HTTP 端点文档列出的请求字段和权限。