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.
apiKeyAuthorizationBearer <chave de API>Authorization: Bearer won_live_..., a key from the console.
application/json- body
url*stringWhere to send events: an https:// URL that is reachable from the internet.
length <= 2000events?array<string|>The types to send, such as ["reply.received", "email.bounced"]. Default ["*"].
1 <= items <= 21[ "*"]campaign_id?stringOnly events of this campaign.
length <= 40metadata?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- 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 }}Última atualização em