Jinba Toolbox
Guides

Webhooks

イベント通知の設定

概要

ツール実行やバージョン公開時にHTTPで通知を受け取れます。

イベント

イベント説明
tool.run.completedツール実行が成功
tool.run.failedツール実行が失敗
toolset.published新バージョンを公開

設定方法

  1. サイドバーの「Webhooks」を開く
  2. 「New Webhook」をクリック
  3. URLとイベントを設定
  4. 表示されるsecretを保存(署名検証に使用)

ペイロード

{
  "event": "tool.run.completed",
  "timestamp": "2024-01-15T10:00:00.000Z",
  "data": {
    "runId": "run_xxx",
    "toolSetSlug": "my-toolset",
    "toolSlug": "my-tool",
    "status": "success"
  }
}

署名検証

X-Webhook-Signatureヘッダーで署名を検証できます。

import hmac
import hashlib

def verify(payload: str, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), payload.encode(), hashlib.sha256).hexdigest()
    return signature == f"sha256={expected}"

リトライ

配信失敗時は最大3回リトライされます(1分後、5分後、30分後)。

HTTPステータス200-299で成功と見なされます。

On this page