Skip to main content

Best Practices

Designing the workflow itself (channels, severity, critical, digest, conditions, templates)? See design-workflow/. This file covers trigger-side best practices only — idempotency, retries, payload design, and topic vs bulk choice.

Idempotency

transactionId is unique to each workflow trigger (event). Novu generates unique transactionId if not provided during trigger. It can be used for idempotennt workflow run and to cancel the pending workflow run later
Deterministic IDs (based on the event context) are preferred over random UUIDs — they naturally prevent duplicate triggers for the same event.

Error Handling

Retry Strategy

For transient failures (5xx errors, network timeouts), use exponential backoff:
Non-retryable errors (do not retry):
  • 401 — Invalid API key
  • 404 — Workflow not found
  • 422 — Payload validation failure

Payload Design

  • Keep payloads small — include IDs and references, not full objects
  • Use the workflow’s payloadSchema to enforce structure
  • Avoid sensitive data in payloads (they may be logged/stored)

Topic vs. Bulk Triggers