本文へスキップ
Won.dev
ドキュメントAPIリファレンス
コールドメールAPI

Webhookを作成する

イベントが起きたら、あなたのURLに送ります。無料。

イベントが起きたら、GET /events が返すのと同じオブジェクトを、JSONのPOSTであなたのURLに送ります。10秒以内に2xxのいずれかで応答してください。それ以外は約1日かけて8回再試行し、3日間失敗し続けたエンドポイントは無効になります。同じイベントが2回届くことがあるので、id で区別してください。各配信には Won-Signature: t=<unix time>,v1=<hex> がつきます。hexは、この呼び出しが返す signing_secret で <t>.<raw body> を計算したHMAC-SHA256です。シークレットが表示されるのはこの1回だけです。* は、高頻度の種類(email.sent、email.opened、email.clicked)を除くすべての種類を意味し、高頻度の種類は名前を挙げたときだけ送られます。Webhookは最大10件です。テストキーで作ったWebhookには、サンドボックスのイベントだけが届きます。無料です。

  • 課金: 無料。

テストキー(won_test_...)では、これはサンドボックスで動きます。何も送信されず、課金もされません。

POST
/webhooks

認証

apiKey
headerAuthorizationBearer <APIキー>

Authorization: Bearer won_live_..., a key from the console.

リクエストボディ

application/json
  1. body
url*string

Where to send events: an https:// URL that is reachable from the internet.

長さlength <= 2000
events?array<string|>

The types to send, such as ["reply.received", "email.bounced"]. Default ["*"].

要素1 <= items <= 21
デフォルト
[  "*"]
campaign_id?string

Only events of this campaign.

長さlength <= 40
metadata?

Your own keys and values, such as {"customer_id": "c_812"}: up to 20 keys of at most 40 characters, each value a string of at most 500. Returned with the webhook. Events do not carry it: the same event goes to every webhook.

レスポンスボディ

The result.

application/json
  1. response
data*

The webhook, with the secret its deliveries are signed with.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

リクエストの例
curl -X POST 'https://api.won.dev/v1/webhooks' \  -H 'Content-Type: application/json' \  -d '{  "url": "https://agent.example/hooks/won",  "events": [    "reply.received",    "email.bounced"  ]}'
レスポンスの例
{  "data": {    "id": "whk_2m9x7p1q8w3e5r4k",    "url": "https://agent.example/hooks/won",    "events": [      "reply.received",      "email.bounced"    ],    "campaign_id": null,    "status": "enabled",    "disabled_reason": null,    "metadata": {},    "created_at": "2026-11-18T13:58:00.000Z",    "signing_secret": "whsec_4Zb1rW8sQ0nT7vYcK3mL9xDfH2gJ6pA5"  },  "notice": null,  "usage": {    "cost": 0,    "balance": 48.08,    "replayed": false  }}

最終更新日