Ir al contenido
WhatsMarketingDeveloper Hub

Webhooks

Suscribir y dar de baja webhooks desde tu sistema, como hacen los disparadores de Zapier y Make. Necesita webhooks:write en una clave creada por un administrador. Cada evento pide además el permiso de lo que entrega (por ejemplo, contact.created pide contacts:read; message.status, messages:send). Una clave solo ve y da de baja los webhooks que dio de alta ella, y al anularla se borran. Pausar, ver entregas y reintentar se hace en el panel. Ver la guía Webhooks.

Eventos disponibles

GET/webhooks/events

La lista de eventos a los que se puede suscribir un webhook, con su nombre legible.

Permisos: webhooks:write

curl
curl "https://micuenta.whatsmarketing.es/api/v1/webhooks/events" \
  -H "Authorization: Bearer $WM_API_KEY"
Node.js
const res = await fetch('https://micuenta.whatsmarketing.es/api/v1/webhooks/events', {
  headers: {
    Authorization: `Bearer ${process.env.WM_API_KEY}`,
  },
});
const data = await res.json();
Python
import os, requests

r = requests.get(
    "https://micuenta.whatsmarketing.es/api/v1/webhooks/events",
    headers={"Authorization": f"Bearer {os.environ['WM_API_KEY']}"},
    timeout=30,
)
r.raise_for_status()
data = r.json()
PHP
<?php
$ch = curl_init('https://micuenta.whatsmarketing.es/api/v1/webhooks/events');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('WM_API_KEY'),
  ],
]);
$data = json_decode(curl_exec($ch), true);
Respuesta 200
[
  {
    "key": "message.status",
    "label": "Un mensaje enviado por API se entregó, se leyó o falló"
  }
]

Listar webhooks

GET/webhooks

Los webhooks que dio de alta esta clave, con el secreto enmascarado y las entregas de los últimos 7 días.

Permisos: webhooks:write

curl
curl "https://micuenta.whatsmarketing.es/api/v1/webhooks" \
  -H "Authorization: Bearer $WM_API_KEY"
Node.js
const res = await fetch('https://micuenta.whatsmarketing.es/api/v1/webhooks', {
  headers: {
    Authorization: `Bearer ${process.env.WM_API_KEY}`,
  },
});
const data = await res.json();
Python
import os, requests

r = requests.get(
    "https://micuenta.whatsmarketing.es/api/v1/webhooks",
    headers={"Authorization": f"Bearer {os.environ['WM_API_KEY']}"},
    timeout=30,
)
r.raise_for_status()
data = r.json()
PHP
<?php
$ch = curl_init('https://micuenta.whatsmarketing.es/api/v1/webhooks');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('WM_API_KEY'),
  ],
]);
$data = json_decode(curl_exec($ch), true);
Respuesta 200
[
  {
    "sent7d": 42,
    "failed7d": 0,
    "id": "8c7b6a5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d",
    "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
    "maskedSecret": "whsec_1a2b…",
    "events": [
      "message.status"
    ],
    "eventLabels": [
      "Un mensaje enviado por API se entregó, se leyó o falló"
    ],
    "status": "ACTIVE",
    "failureStreak": 0,
    "lastDeliveryAt": "2026-11-11T10:05:00.000Z",
    "lastSuccessAt": "2026-11-11T10:05:00.000Z",
    "createdAt": "2026-11-11T10:00:00.000Z"
  }
]

Suscribir un webhook

POST/webhooks

Una URL https pública y los eventos. Responde con el webhook y su secret (whsec_…), que solo se devuelve aquí: guárdalo para verificar la firma. Hasta 10 por organización y 10 altas por minuto.

Permisos: webhooks:write

Cuerpo de la petición CreateWebhook

NombreTipoValores
url obligatoriostring0–500 caracteres
events obligatoriostring[]≤ 20

Errores frecuentes

  • 400 WEBHOOK_URL_NOT_PUBLIC La URL apunta a una dirección privada o local.
  • 403 La clave no tiene webhooks:write o no la creó un administrador.
  • 403 WEBHOOK_EVENT_SCOPE_MISSING La clave no puede leer los datos de alguno de los eventos.
  • 409 WEBHOOKS_LIMIT Ya hay 10 webhooks: da de baja alguno.
curl
curl -X POST "https://micuenta.whatsmarketing.es/api/v1/webhooks" \
  -H "Authorization: Bearer $WM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
  "events": [
    "message.status"
  ]
}'
Node.js
const res = await fetch('https://micuenta.whatsmarketing.es/api/v1/webhooks', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.WM_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
    "events": [
      "message.status"
    ]
  }),
});
const data = await res.json();
Python
import os, requests

r = requests.post(
    "https://micuenta.whatsmarketing.es/api/v1/webhooks",
    headers={"Authorization": f"Bearer {os.environ['WM_API_KEY']}"},
    json={
        "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
        "events": [
            "message.status"
        ]
    },
    timeout=30,
)
r.raise_for_status()
data = r.json()
PHP
<?php
$ch = curl_init('https://micuenta.whatsmarketing.es/api/v1/webhooks');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('WM_API_KEY'),
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => json_encode([
    'url' => 'https://hooks.zapier.com/hooks/catch/123/abc/',
    'events' => [
      'message.status'
    ]
  ]),
]);
$data = json_decode(curl_exec($ch), true);
Respuesta 201
{
  "sent7d": 42,
  "failed7d": 0,
  "id": "8c7b6a5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d",
  "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
  "maskedSecret": "whsec_1a2b…",
  "events": [
    "message.status"
  ],
  "eventLabels": [
    "Un mensaje enviado por API se entregó, se leyó o falló"
  ],
  "status": "ACTIVE",
  "failureStreak": 0,
  "lastDeliveryAt": "2026-11-11T10:05:00.000Z",
  "lastSuccessAt": "2026-11-11T10:05:00.000Z",
  "createdAt": "2026-11-11T10:00:00.000Z",
  "secret": "whsec_…"
}

Ver un webhook

GET/webhooks/{id}

Un webhook con su secreto enmascarado. 404 si no lo dio de alta esta clave.

Permisos: webhooks:write

Parámetros

NombreDóndeTipoValores
id obligatoriorutastring
curl
curl "https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}" \
  -H "Authorization: Bearer $WM_API_KEY"
Node.js
const res = await fetch('https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}', {
  headers: {
    Authorization: `Bearer ${process.env.WM_API_KEY}`,
  },
});
const data = await res.json();
Python
import os, requests

r = requests.get(
    "https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}",
    headers={"Authorization": f"Bearer {os.environ['WM_API_KEY']}"},
    timeout=30,
)
r.raise_for_status()
data = r.json()
PHP
<?php
$ch = curl_init('https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('WM_API_KEY'),
  ],
]);
$data = json_decode(curl_exec($ch), true);
Respuesta 200
{
  "sent7d": 42,
  "failed7d": 0,
  "id": "8c7b6a5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d",
  "url": "https://hooks.zapier.com/hooks/catch/123/abc/",
  "maskedSecret": "whsec_1a2b…",
  "events": [
    "message.status"
  ],
  "eventLabels": [
    "Un mensaje enviado por API se entregó, se leyó o falló"
  ],
  "status": "ACTIVE",
  "failureStreak": 0,
  "lastDeliveryAt": "2026-11-11T10:05:00.000Z",
  "lastSuccessAt": "2026-11-11T10:05:00.000Z",
  "createdAt": "2026-11-11T10:00:00.000Z"
}

Dar de baja un webhook

DELETE/webhooks/{id}

Lo elimina con su historial de entregas. Es lo que llama Zapier o Make al apagar un disparador.

Permisos: webhooks:write

Parámetros

NombreDóndeTipoValores
id obligatoriorutastring
curl
curl -X DELETE "https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}" \
  -H "Authorization: Bearer $WM_API_KEY"
Node.js
const res = await fetch('https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.WM_API_KEY}`,
  },
});
const data = await res.json();
Python
import os, requests

r = requests.delete(
    "https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}",
    headers={"Authorization": f"Bearer {os.environ['WM_API_KEY']}"},
    timeout=30,
)
r.raise_for_status()
data = r.json()
PHP
<?php
$ch = curl_init('https://micuenta.whatsmarketing.es/api/v1/webhooks/{id}');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('WM_API_KEY'),
  ],
]);
$data = json_decode(curl_exec($ch), true);
Respuesta 200
{
  "id": "8c7b6a5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d",
  "deleted": true
}