Webhooks (salientes)

CRUD de los webhooks que tu organización registra para recibir eventos de Mosend.

Base path: /organizations/:orgId/webhooks-outbound·7 endpoints·Source: mosend-wb-backend/src/modules/webhooks-outbound/webhooks-outbound.controller.ts
GET/organizations/:orgId/webhooks-outbound
bearer

Lista los webhooks salientes de la organización (sin el secret).

Path params

  • orgIdstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/webhooks-outbound
bearer

Crea un webhook saliente suscrito a eventos.

Path params

  • orgIdstringrequerido

Body (JSON)

  • urlstring · urirequerido
  • eventsstring[]requerido
  • formatstring
    GENERICTEAMS

    Si no se pasa, el service auto-detecta a partir de la URL (Teams si es webhook.office.com etc., GENERIC en cualquier otro caso).

  • unansweredThresholdMinutesnumber

    Solo relevante si `events` incluye 'conversation.unanswered'. Min 1 para evitar spam (sub-minuto el cron no lo respeta) y Max 1440 (24h) como sanity check.

  • phoneNumberIdsstring[]

    Restricción opcional por phone-number. Vacío/ausente = el hook recibe eventos de TODOS los números (default). Si trae UUIDs, sólo recibe los de esos números.

  • agentStatusesstring[]

    Solo relevante si `events` incluye 'agent.status_changed'. Qué estados de jornada notificar. Vacío/ausente = todas las transiciones.

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://tu-app.com/endpoint","events": [],"format": "GENERIC","unansweredThresholdMinutes": 0,"phoneNumberIds": [],"agentStatuses": []}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:orgId/webhooks-outbound/:id
bearer

Actualiza un webhook saliente (URL, eventos, formato, estado).

Path params

  • orgIdstringrequerido
  • idstringrequerido

Body (JSON)

  • urlstring · uri
  • eventsstring[]
  • formatstring
    GENERICTEAMS
  • activeboolean
  • unansweredThresholdMinutesnumber
  • phoneNumberIdsstring[]
  • agentStatusesstring[]

Respuestas

  • 200
curl -X PATCH 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound/00000000-0000-0000-0000-000000000000' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://tu-app.com/endpoint","events": [],"format": "GENERIC","active": true,"unansweredThresholdMinutes": 0,"phoneNumberIds": [],"agentStatuses": []}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
DELETE/organizations/:orgId/webhooks-outbound/:id
bearer

Elimina un webhook saliente.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 204
curl -X DELETE 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound/00000000-0000-0000-0000-000000000000' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/webhooks-outbound/:id/test
bearer

Envía un evento de prueba (webhook.test) al webhook para verificar que su endpoint lo recibe.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound/00000000-0000-0000-0000-000000000000/test' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/webhooks-outbound/:id/deliveries
bearer

Lista el historial de entregas de un webhook saliente.

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound/00000000-0000-0000-0000-000000000000/deliveries' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/webhooks-outbound/:id/secret
bearer

Revela el secret de firma del webhook (no aparece en el listado).

Path params

  • orgIdstringrequerido
  • idstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/webhooks-outbound/00000000-0000-0000-0000-000000000000/secret' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}