Webhookブロック YAMLスキーマ
Webhookブロックの YAML設定リファレンス
スキーマ定義
type: object
required:
- type
- name
properties:
type:
type: string
enum: [webhook]
description: Block type identifier
name:
type: string
description: Display name for this webhook block
inputs:
type: object
properties:
webhookConfig:
type: object
description: Webhook configuration settings
properties:
enabled:
type: boolean
description: Whether the webhook is active
default: true
secret:
type: string
description: Secret key for webhook verification
headers:
type: array
description: Expected headers for validation as table entries
items:
type: object
properties:
id:
type: string
description: Unique identifier for the header entry
key:
type: string
description: Header name
value:
type: string
description: Expected header value
cells:
type: object
description: Cell display values for the table interface
properties:
Key:
type: string
description: Display value for the key column
Value:
type: string
description: Display value for the value column
methods:
type: array
description: Allowed HTTP methods
items:
type: string
enum: [GET, POST, PUT, DELETE, PATCH]
default: [POST]
responseConfig:
type: object
description: Response configuration for the webhook
properties:
status:
type: number
description: HTTP status code to return
default: 200
minimum: 100
maximum: 599
headers:
type: array
description: Response headers as table entries
items:
type: object
properties:
id:
type: string
description: Unique identifier for the header entry
key:
type: string
description: Header name
value:
type: string
description: Header value
cells:
type: object
description: Cell display values for the table interface
properties:
Key:
type: string
description: Display value for the key column
Value:
type: string
description: Display value for the value column
body:
type: string
description: Response body content
connections:
type: object
properties:
success:
type: string
description: Target block ID for successful webhook processing
error:
type: string
description: Target block ID for error handling
接続設定
接続はwebhook処理に基づいてワークフローの進行先を定義します:
connections:
success: <string> # Target block ID for successful processing
error: <string> # Target block ID for error handling (optional)
例
基本的なWebhookトリガー
github-webhook:
type: webhook
name: "GitHub Webhook"
inputs:
webhookConfig:
enabled: true
secret: "{{GITHUB_WEBHOOK_SECRET}}"
methods: [POST]
headers:
- key: "X-GitHub-Event"
value: "push"
responseConfig:
status: 200
body: |
{
"message": "Webhook received successfully",
"timestamp": "{{new Date().toISOString()}}"
}
connections:
success: process-github-event
error: webhook-error-handler
Slackイベントウェブフック
slack-events:
type: webhook
name: "Slack Events"
inputs:
webhookConfig:
enabled: true
secret: "{{SLACK_SIGNING_SECRET}}"
methods: [POST]
headers:
- key: "Content-Type"
value: "application/json"
responseConfig:
status: 200
headers:
- key: "Content-Type"
value: "application/json"
body: |
{
"challenge": "<webhook.challenge>"
}
connections:
success: handle-slack-event
決済Webhook(Stripe)
stripe-webhook:
type: webhook
name: "Stripe Payment Webhook"
inputs:
webhookConfig:
enabled: true
secret: "{{STRIPE_WEBHOOK_SECRET}}"
methods: [POST]
headers:
- key: "Stripe-Signature"
value: "*"
responseConfig:
status: 200
headers:
- key: "Content-Type"
value: "application/json"
body: |
{
"received": true
}
connections:
success: process-payment-event
error: payment-webhook-error
完全なテーブルヘッダー形式を持つWebhook
ヘッダーがUIテーブルインターフェースを通じて作成される場合、YAMLには追加のメタデータが含まれます:
api-webhook-complete:
type: webhook
name: "API Webhook with Table Headers"
inputs:
webhookConfig:
enabled: true
methods: [POST]
headers:
- id: header-1-uuid-here
key: "Authorization"
value: "Bearer {{WEBHOOK_API_KEY}}"
cells:
Key: "Authorization"
Value: "Bearer {{WEBHOOK_API_KEY}}"
- id: header-2-uuid-here
key: "Content-Type"
value: "application/json"
cells:
Key: "Content-Type"
Value: "application/json"
responseConfig:
status: 200
headers:
- id: response-header-1-uuid
key: "Content-Type"
value: "application/json"
cells:
Key: "Content-Type"
Value: "application/json"
- id: response-header-2-uuid
key: "X-Webhook-Response"
value: "processed"
cells:
Key: "X-Webhook-Response"
Value: "processed"
body: |
{
"status": "received",
"timestamp": "{{new Date().toISOString()}}"
}
connections:
success: process-webhook-complete
汎用APIウェブフック
api-webhook:
type: webhook
name: "API Webhook"
inputs:
webhookConfig:
enabled: true
methods: [POST, PUT]
headers:
- key: "Authorization"
value: "Bearer {{WEBHOOK_API_KEY}}"
- key: "Content-Type"
value: "application/json"
responseConfig:
status: 202
headers:
- key: "Content-Type"
value: "application/json"
- key: "X-Processed-By"
value: "Sim"
body: |
{
"status": "accepted",
"id": "{{Math.random().toString(36).substr(2, 9)}}",
"received_at": "{{new Date().toISOString()}}"
}
connections:
success: process-webhook-data
複数メソッドWebhook
crud-webhook:
type: webhook
name: "CRUD Webhook"
inputs:
webhookConfig:
enabled: true
methods: [GET, POST, PUT, DELETE]
headers:
- key: "X-API-Key"
value: "{{CRUD_API_KEY}}"
responseConfig:
status: 200
headers:
- key: "Content-Type"
value: "application/json"
body: |
{
"method": "<webhook.method>",
"processed": true,
"timestamp": "{{new Date().toISOString()}}"
}
connections:
success: route-by-method
テーブルパラメータ形式
Webhookブロックは、ヘッダー(検証ヘッダーとレスポンスヘッダーの両方)に対して2つの形式をサポートしています:
簡易形式(手動YAML)
YAMLを手動で記述する場合、簡易形式を使用できます:
headers:
- key: "Authorization"
value: "Bearer {{API_TOKEN}}"
- key: "Content-Type"
value: "application/json"
完全なテーブル形式(UI生成)
ヘッダーがUIテーブルインターフェースを通じて作成される場合、YAMLには追加のメタデータが含まれます:
headers:
- id: unique-identifier-here
key: "Authorization"
value: "Bearer {{API_TOKEN}}"
cells:
Key: "Authorization"
Value: "Bearer {{API_TOKEN}}"
主な違い:
id
:テーブル行を追跡するための一意の識別子cells
:UIテーブルインターフェースで使用される表示値- 両方の形式はウェブフック処理において機能的に同等です
- 完全な形式はワークフローのインポート/エクスポート時にUI状態を保持します
重要: 特殊文字を含むヘッダー名と値は常に引用符で囲んでください:
headers:
- id: auth-header-uuid
cells:
Key: "Authorization"
Value: "Bearer {{WEBHOOK_API_KEY}}"
- id: content-type-uuid
cells:
Key: "Content-Type"
Value: "application/json"
ウェブフック変数
ウェブフックでトリガーされるワークフロー内では、以下の特別な変数が利用可能です:
# Available in blocks after the webhook
<webhook.payload> # Full request payload/body
<webhook.headers> # Request headers
<webhook.method> # HTTP method used
<webhook.query> # Query parameters
<webhook.path> # Request path
<webhook.challenge> # Challenge parameter (for verification)
出力参照
ウェブフックがリクエストを処理した後、そのデータを参照できます:
# In subsequent blocks
process-webhook:
inputs:
payload: <webhook-name.payload> # Request payload
headers: <webhook-name.headers> # Request headers
method: <webhook-name.method> # HTTP method
セキュリティのベストプラクティス
- 検証にはウェブフックシークレットを常に使用する
- 予想されるヘッダーとメソッドを検証する
- 適切なエラー処理を実装する
- 本番環境ではHTTPSエンドポイントを使用する
- ウェブフックのアクティビティと失敗を監視する
- 適切な応答タイムアウトを設定する
- 処理前にペイロード構造を検証する