Integraciones

Webhooks salientes

Recibe eventos en tiempo real desde Wapsy a tu propia URL. Cada request va firmado con HMAC-SHA256 para que verifiques el origen.

Configurar

Crea uno en Ajustes → Webhooks. Necesitas:

  • URL HTTPS de tu endpoint
  • Lista de eventos a los que te suscribes

Wapsy te da un secret al crear el webhook — guárdalo (se muestra una vez).

Eventos disponibles

  • conversation.created
  • message.received
  • message.sent
  • deal.created
  • deal.moved
  • deal.won
  • deal.lost
  • contact.created
  • tag.added
  • csat.received

Formato del payload

{
  "event": "conversation.created",
  "organizationId": "org_xxx",
  "occurredAt": "2026-05-28T14:32:11.000Z",
  "data": {
    "conversationId": "conv_xxx",
    "contactId": "cnt_xxx",
    "channelType": "whatsapp"
  }
}

Verificar firma (Node.js)

import crypto from 'crypto';

app.post('/webhook/wapsy', (req, res) => {
  const signature = req.headers['x-wapsy-signature'];
  const body = JSON.stringify(req.body);

  const expected = 'sha256=' + crypto
    .createHmac('sha256', process.env.WAPSY_WEBHOOK_SECRET)
    .update(body)
    .digest('hex');

  if (signature !== expected) {
    return res.status(403).send('Invalid signature');
  }

  // Process event
  console.log(req.body.event, req.body.data);
  res.status(200).send('OK');
});

Retries

Si tu endpoint responde con status ≠ 2xx, Wapsy no reintenta automáticamente todavía. Lo recomendado: responder 2xx rápido y procesar async.

Cada intento queda guardado en el activity log del webhook (visible en Ajustes → Webhooks → detalles).