Saltar al contenido principal

Eventos de regla de cobranza (collection_rule.*)

Configuración de las reglas de cobranza. En los eventos de entidad, data es la regla con la classification vinculada y los steps ordenados por posición.

Valores de triggerType (paso): before_due · on_due · after_due · after_issue · after_payment. Valores de actionType: notification · negativation · protest · manual_task · negotiation_offer · judicial. Valores de tone: friendly · neutral · firm · urgent.

collection_rule.created

{
"event": "collection_rule.created",
"timestamp": "2026-07-23T12:00:00.000Z",
"organizationId": "0f7a3c1e-2b4d-4e6f-8a9b-1c2d3e4f5a6b",
"data": {
"id": "8f6a4c2e-1b3d-4e5f-a7c9-2d4f6b8a0e1c",
"publicId": "a7b8c9d0-e1f2-4a3b-4c5d-6e7f80910213",
"organizationId": "0f7a3c1e-2b4d-4e6f-8a9b-1c2d3e4f5a6b",
"workspaceId": null,
"companyId": null,
"businessUnitId": null,
"classificationId": "5d8e2f4a-6b1c-4d3e-9f7a-8c5b2d4e6f1a",
"name": "Régua padrão B2B",
"description": "Lembrete antes do vencimento + escalada pós-vencimento",
"isDefault": true,
"priority": 0,
"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",
"classification": {
"id": "5d8e2f4a-6b1c-4d3e-9f7a-8c5b2d4e6f1a",
"name": "Bom pagador",
"code": "good_payer",
"color": "#22c55e",
"...": "clasificación completa (mismo shape que classification.created)"
},
"steps": [
{
"id": "1b3d5f7a-9c2e-4f6b-8d0a-3e5f7a9c1b3e",
"publicId": "b8c9d0e1-f2a3-4b4c-5d6e-7f8091021324",
"collectionRuleId": "8f6a4c2e-1b3d-4e5f-a7c9-2d4f6b8a0e1c",
"messageTemplateId": "7a9c1e3f-5b2d-4c6e-8f0a-9d1b3f5a7c9f",
"position": 1,
"name": "Lembrete D-3",
"triggerType": "before_due",
"triggerDays": 3,
"actionType": "notification",
"channels": ["email", "whatsapp"],
"tone": "friendly",
"preferredTime": "09:00",
"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"
}
]
}
}

collection_rule.updated

Se dispara cuando la regla (o sus pasos) se modifica. Mismo shape que collection_rule.created, con los steps ya en la composición final.

collection_rule.deleted

Se dispara en la eliminación (lógica); bloqueada si algún cobro referencia la regla — en ese caso el evento no ocurre.

{
"event": "collection_rule.deleted",
"timestamp": "2026-07-23T12:00:00.000Z",
"organizationId": "0f7a3c1e-2b4d-4e6f-8a9b-1c2d3e4f5a6b",
"data": { "id": "8f6a4c2e-1b3d-4e5f-a7c9-2d4f6b8a0e1c" }
}