Eventos de plantilla (template.*)
Plantillas de mensaje usadas por los pasos de la regla de cobranza. En los eventos de entidad, data es la plantilla completa (sin relaciones).
Valores de channel: email · sms · whatsapp · voice · manual. Valores de category: reminder · overdue · negotiation · negativation_warning · protest_warning · payment_confirmation. Valores de tone: friendly · neutral · firm · urgent.
template.created
Se dispara en la creación y también en la duplicación (POST /templates/{id}/duplicate — la copia llega con nombre nuevo y activatedAt: null).
{
"event": "template.created",
"timestamp": "2026-07-23T12:00:00.000Z",
"organizationId": "0f7a3c1e-2b4d-4e6f-8a9b-1c2d3e4f5a6b",
"data": {
"id": "7a9c1e3f-5b2d-4c6e-8f0a-9d1b3f5a7c9f",
"publicId": "c9d0e1f2-a3b4-4c5d-6e7f-809102132435",
"organizationId": "0f7a3c1e-2b4d-4e6f-8a9b-1c2d3e4f5a6b",
"workspaceId": null,
"companyId": null,
"businessUnitId": null,
"name": "Lembrete amigável D-3",
"channel": "email",
"category": "reminder",
"tone": "friendly",
"subject": "Sua fatura vence em {{dias_para_vencimento}} dias",
"body": "Olá {{nome}}, sua fatura de {{valor}} vence em {{data_vencimento}}. Pague pelo link: {{link_pagamento}}",
"variables": ["nome", "valor", "data_vencimento", "dias_para_vencimento", "link_pagamento"],
"activatedAt": "2026-07-23T12:00:00.000Z",
"externalId": null,
"customData": null,
"tags": [],
"deletedAt": null,
"metadata": {},
"createdAt": "2026-07-23T12:00:00.000Z",
"updatedAt": "2026-07-23T12:00:00.000Z"
}
}
template.updated
Se dispara cuando la plantilla se modifica. Mismo shape que template.created.
template.deleted
Se dispara en la eliminación (lógica); bloqueada si la plantilla está referenciada por algún paso de regla — en ese caso el evento no ocurre.
{
"event": "template.deleted",
"timestamp": "2026-07-23T12:00:00.000Z",
"organizationId": "0f7a3c1e-2b4d-4e6f-8a9b-1c2d3e4f5a6b",
"data": { "id": "7a9c1e3f-5b2d-4c6e-8f0a-9d1b3f5a7c9f" }
}