Ir al contenido
Won.dev
DocumentaciónReferencia de la API
API de correo en frío

Crear un webhook

Recibe los eventos en una URL tuya a medida que ocurren. Gratis.

Envía los eventos a una URL tuya a medida que ocurren, como un POST JSON con el mismo objeto que devuelve GET /events. Responde con cualquier 2xx en menos de 10 segundos; cualquier otra cosa se reintenta, ocho veces a lo largo de alrededor de un día, y un endpoint que falla durante tres días se desactiva. El mismo evento puede llegar dos veces: distínguelos por id. Cada entrega trae Won-Signature: t=<unix time>,v1=<hex>, donde el hex es el HMAC-SHA256 de <t>.<raw body> con el signing_secret que devuelve esta llamada. El secreto se muestra solo esta vez. * significa todos los tipos excepto los frecuentes (email.sent, email.opened, email.clicked), que solo se envían cuando se nombran. Hasta 10 webhooks. Un webhook creado con una clave de prueba recibe los eventos del sandbox, y solo esos. Gratis.

  • Cobro: Gratis.

Una clave de prueba (won_test_...) ejecuta esto en el sandbox: no se envía ni se cobra nada.

POST
/webhooks

Autenticación

apiKey
headerAuthorizationBearer <clave de API>

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

Cuerpo de la solicitud

application/json
  1. body
url*string

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

Longitudlength <= 2000
events?array<string|>

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

Elementos1 <= items <= 21
Valor predeterminado
[  "*"]
campaign_id?string

Only events of this campaign.

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

Cuerpo de la respuesta

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.

Solicitud de ejemplo
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"  ]}'
Respuesta de ejemplo
{  "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 actualización: