Email Template
An Email Template represents the message structure and copywriting of transactional emails sent to your loyalty program members. These templates contain a subject line, an HTML body, and link to an optional Email Header and Email Footer to form complete branded emails.
Both subject and htmlContent fields are localisable. Pass a languageCode query parameter when updating or fetching the email template to manage translated copy for your international users.
How it works
- Create an email template — define a name, description, status, subject line, and the HTML body content.
- Assign layout wrappers — link an
EmailHeader(emailHeaderId) andEmailFooter(emailFooterId) to structure the overall email frame. - Choose the sample event code — select a
sampleEventCode(e.g.streak_progress_broken,challenge_progress_completed) to get the sample event data to design your email template. This field is used to select the sample event data to design your email template and not trigger the email itself. To send an email on the basis of event, you will need to configure Email Notification. - Define dynamic variables — write your template using curly braces
{{ }}to merge dynamic details (like member details, streak or challenge details, and streak status) during delivery. - Attach to email notifications — link the template to an active Email Notification rule to automate delivery.
Fields
Basic information
| Field | Type | Required | Max length | Description |
|---|---|---|---|---|
name | string | ✅ | 256 | The name of the email template |
description | string | ❌ | 1 024 | A brief description of the email template |
status | enum | ✅ | — | draft · live · paused |
Configuration settings
| Field | Type | Required | Description |
|---|---|---|---|
emailHeaderId | UUID | ❌ | Optional reference to an Email Header |
emailFooterId | UUID | ❌ | Optional reference to an Email Footer |
sampleEventCode | enum | ✅ | The sample event code to pick the sample event data for template designing. See Event Codes below. |
Copy and content
| Field | Type | Required | Max length | Description |
|---|---|---|---|---|
subject | string | ✅ | 256 | The email subject line. Supports variables and localisation. |
htmlContent | string | ✅ | — | The HTML body of the email. Supports variables and localisation. |
Event codes
The sampleEventCode maps the email template to a specific type of loyalty event. The template will receive event-specific variables at runtime:
streak_progress_brokenstreak_progress_to_be_brokenstreak_progress_completedstreak_progress_milestone_completedstreak_progress_non_milestone_completedstreak_progress_in_progresschallenge_progress_failedchallenge_progress_to_be_failedchallenge_progress_completedchallenge_progress_milestone_completedchallenge_progress_in_progress
Template variables
The template rendering engine replaces double curly braces {{ }} with event data.
Common variable namespaces supported
Available in all templates:
| Variable | Description | Example value |
|---|---|---|
{{$organization.*}} | Organization variables | {{$organization.name}}. Refer to Organization for more details on available variables names. |
{{$account.*}} | Account variables | {{$account.name}}. Refer to Account for more details on available variables names. |
{{$account_user.*}} | Account User (Member) variables | {{$account_user.firstName}}, {{$account_user.lastName}}, {{$account_user.email}}. Refer to Member for more details on available variables names. |
{{$event_log.payload.*}} | Event log variables | {{$event_log.payload.streakLog}}, {{$event_log.payload.challengeLog}}, {{$event_log.payload.streakProgress}}, {{$event_log.payload.challengeProgress}}. Refer more on this below. |
{{$helpers.*}} | Helper variables | {{$helpers.periodText}}, {{$helpers.currentProgressValue}}, {{$helpers.nextMilestoneRemainingValue}}. Refer more on this below. |
Event Log variables
| Variable | Description | Example value |
|---|---|---|
{{$event_log.payload.streakLog}} | Streak log object (When sampleEventCode is one of streak_progress_completed, streak_progress_milestone_completed, streak_progress_non_milestone_completed, streak_progress_in_progress ) | Refer this Streak Log for object details |
{{$event_log.payload.challengeLog}} | Challenge log object (When sampleEventCode is one of challenge_progress_completed, challenge_progress_milestone_completed, challenge_progress_in_progress) | Refer this Challenge Log for object details |
{{$event_log.payload.streakProgress}} | Streak progress object (When sampleEventCode is one of streak_progress_broken, streak_progress_to_be_broken) | Refer below for the object structure |
{{$event_log.payload.challengeProgress}} | Challenge progress object (When sampleEventCode is one of challenge_progress_failed, challenge_progress_to_be_failed) | Refer below for the object structure |
$event_log.payload.streakProgress
Code
Refer this Streak Progress for object details
Refer this Streak for object details
Refer this Milestone for object details
$event_log.payload.challengeProgress
Code
Refer this Challenge Progress for object details
Refer this Challenge for object details
Refer this Milestone for object details
Streak event helper variables
Available when sampleEventCode begins with streak_:
| Variable | Description | Example value |
|---|---|---|
{{$helpers.unsubscribeUrl}} | The unsubscribe URL of the user. This URL is unique for each user. | |
{{$helpers.periodText}} | Aggregation period unit | day · week · month |
{{$helpers.remainingValue}} | Steps/spend remaining to keep the streak. It is same as either {{$helpers.nextMilestoneRemainingValue}} or {{$helpers.nextNonMilestoneRemaining Value}} depending on the current streak progress. | 10.00 |
{{$helpers.nextMilestoneRemainingValue}} | Steps/spend remaining to reach the next milestone | 150.00 |
{{$helpers.nextNonMilestoneRemainingValue}} | Steps/spend remaining to reach the next non-milestone | 50.00 |
{{$helpers.currentProgressValue}} | Current active streak length | 5 |
{{$helpers.nextMilestoneTargetValue}} | Target value for the next milestone | 3 |
{{$helpers.nextNonMilestoneTargetValue}} | Target value for the next non-milestone | 2 |
{{$helpers.completionTargetValue}} | Target value for the current period | 3 |
{{$helpers.formattedStreakToBeBrokenAt}} | Expiration time for active period | 2026-07-20 23:59:59 |
Challenge event helper variables
Available when sampleEventCode begins with challenge_:
| Variable | Description | Example value |
|---|---|---|
{{$helpers.unsubscribeUrl}} | The unsubscribe URL of the user. This URL is unique for each user. | |
{{$helpers.periodText}} | Duration of the challenge window | day · week · month |
{{$helpers.remainingValue}} | Steps/spend remaining to complete the challenge | 100.00 |
{{$helpers.currentProgressValue}} | Total accumulated value | 25.00 |
{{$helpers.nextMilestoneRemainingValue}} | Value needed for next milestone | 25.00 |
{{$helpers.completionTargetValue}} | Target value for the current period | 150.00 |
{{$helpers.formattedChallengeToBeFailedAt}} | Expiration time for active period | 2026-07-20 23:59:59 |
Real-world examples
🛍️ E-commerce — Streak Milestone Reached Template
An email template sent when a user earns a coupon for maintaining their daily purchase streak:
Code
Access & permissions
| Caller | Allowed operations | Notes |
|---|---|---|
| Admin | CREATE · GET · LIST · UPDATE · DELETE | Full control over email templates |
| End user | (none) | No access |
| Guest user | (none) | No access |
Related resources
| Resource | Description |
|---|---|
| Email Header | Custom HTML header banner linked to the template |
| Email Footer | Custom HTML footer wrapper linked to the template |
| Email Notification | The active triggers that map event codes to specific templates |
API reference
See the API Reference for full request/response schemas and interactive examples for:
GET /schema/email_template/record— list email templatesPOST /schema/email_template/record— create an email templateGET /schema/email_template/record/{id}— get an email template by IDPATCH /schema/email_template/record/{id}— update an email templateDELETE /schema/email_template/record/{id}— delete an email template