Pular para o conteúdo
Won.dev
DocumentaçãoReferência da API
API de cold mail

Criar um webhook

Receba os eventos numa URL sua conforme eles acontecem. Grátis.

Envia os eventos para uma URL sua conforme eles acontecem, como um POST JSON com o mesmo objeto que GET /events retorna. Responda com qualquer 2xx em até 10 segundos; qualquer outra coisa é tentada de novo, oito vezes ao longo de cerca de um dia, e um endpoint que falha por três dias é desativado. O mesmo evento pode chegar duas vezes: diferencie pelo id. Cada entrega traz Won-Signature: t=<unix time>,v1=<hex>, em que o hex é o HMAC-SHA256 de <t>.<raw body> com o signing_secret que esta chamada retorna. O segredo é mostrado só desta vez. * significa todos os tipos, exceto os frequentes (email.sent, email.opened, email.clicked), que só são enviados quando nomeados. Até 10 webhooks. Um webhook criado com uma chave de teste recebe os eventos do sandbox, e só eles. Grátis.

  • Cobrança: Grátis.

Uma chave de teste (won_test_...) roda isto no sandbox: nada é enviado e nada é cobrado.

POST
/webhooks

Autenticação

apiKey
headerAuthorizationBearer <chave de API>

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

Corpo da requisição

application/json
  1. body
url*string

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

Tamanholength <= 2000
events?array<string|>

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

Itens1 <= items <= 21
Padrão
[  "*"]
campaign_id?string

Only events of this campaign.

Tamanholength <= 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.

Corpo da resposta

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.

Requisição de exemplo
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"  ]}'
Resposta de exemplo
{  "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  }}

Última atualização em