Email Templates: Variables, Previews, and Best Practices

Templates

Templates define how each event_key is rendered into customer-facing content. In SendPromptly, template quality is the difference between reliable lifecycle communication and brittle notification behavior.

Template model

  • One or more templates per event key
  • Environment-scoped activation
  • Versioned updates for safe iteration

When an event is ingested, SendPromptly resolves the active template version for that event_key in the target environment.

Designing stable template contracts

Use payload fields that represent business facts, not temporary UI state. For example:

  • Good: order_id, total, currency, tracking_number
  • Risky: cart_modal_variant, temporary_banner_text

Stable contracts reduce rendering errors and make rollback safer during releases.

Authoring best practices

  • Keep subject lines specific and action-oriented.
  • Use fallback-safe variables for optional fields.
  • Avoid hard-coded environment-specific URLs inside template content.
  • Test with realistic payload samples, including missing optional values.

Versioning and rollout strategy

  1. Draft a new template version in dev.
  2. Validate rendering with representative event payloads.
  3. Promote to stage for QA and approval.
  4. Activate in prod and monitor delivery outcomes.

Common failure modes

  • template_inactive: no active version for the event key.
  • placeholder_missing_in_context: payload missing required variable.

To prevent regressions, pair template updates with payload contract tests in your backend.