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 --versionwebhooks: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エンドポイントに記載されたフィールドと権限を使用してください。