Webhooks
ERPly Pro entrega eventos firmados con HMAC-SHA256 a la URL configurada del tenant.
Eventos
| Evento | Cuándo |
|---|---|
invoice.accepted | DGII aceptó el e-CF. |
invoice.rejected | DGII rechazó el e-CF. |
invoice.failed | Error interno tras el SLA. |
Estructura
POST /tu-webhook HTTP/1.1
Content-Type: application/json
X-ErplyPro-Event: invoice.accepted
X-ErplyPro-Signature: t=1714583811,v1=4f9d…
X-ErplyPro-Delivery: 01HW9X4G…
{
"event": "invoice.accepted",
"docId": "01HW9X4G…",
"trackId": "20260501-DGII-9988",
"tenantId": "demo-rnc-131000001",
"occurredAt": "2026-05-01T17:42:11Z"
}
Verificación de firma
import hmac, hashlib, time
def verify(body: bytes, header: str, secret: bytes, *, max_skew=300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
t = int(parts["t"])
if abs(time.time() - t) > max_skew:
return False
expected = hmac.new(secret, f"{t}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])
POST /v1/webhooks/test
Dispara un evento de prueba contra el endpoint configurado del tenant:
curl -X POST https://sandbox.api.erply.pro/v1/webhooks/test \
-H "Authorization: Bearer $TOKEN"
Reintentos
Back-off exponencial: 1 s, 4 s, 16 s, 64 s, 256 s. Tras 5 fallos consecutivos el evento va a una DLQ y soporte lo redespacha tras corregir el endpoint.