Skip to main content

Notification Email Templates

The Axiom Genesis platform uses customizable HTML email templates for workflow notifications. These templates are Handlebars-enabled and support dynamic variable injection.

Templates Location: axiom-genesis-middleware/templates/

Available Templates

1. Approval Completed (approval-completed.html)

Sent to the request initiator when all approval levels are successfully completed.

Variables:

  • {{requestTitle}} - Title of the request
  • {{initiatorName}} - Name of the person who submitted the request
  • {{totalLevels}} - Total number of approval levels
  • {{submittedAt}} - Date/time when request was submitted
  • {{approvedAt}} - Date/time when final approval was completed
  • {{approvalDuration}} - Total time from submission to approval
  • {{formData}} - Original form data submitted with the request
  • {{approvalHistory}} - Array of approval actions and approvers
  • {{viewDetailsUrl}} - Link to view request details
  • {{downloadApprovalUrl}} - Link to download approval documentation
  • {{requestId}} - Unique request identifier
  • {{instanceId}} - Workflow instance identifier
  • {{referenceNumber}} - Business reference number

Location: axiom-genesis-middleware/templates/approval-completed.html


2. Approval Pending (approval-pending.html)

Notification to approvers that a request awaits their review and decision.

Variables:

  • {{requestTitle}} - Title of the request
  • {{approverName}} - Name of the approver
  • {{levelNumber}} - Current approval level number
  • {{totalLevels}} - Total number of approval levels
  • {{levelTitle}} - Title/description of this approval level
  • {{submitterName}} - Name of the request submitter
  • {{submitterEmail}} - Email of the request submitter
  • {{submittedAt}} - Date/time when request was submitted
  • {{formData}} - Request form data for review
  • {{previousApprovals}} - Array of prior approvals at previous levels
  • {{approveUrl}} - Link to approve the request
  • {{rejectUrl}} - Link to reject the request
  • {{pushbackUrl}} - Link to send back for revision
  • {{deadlineDate}} - Deadline for action
  • {{requestId}} - Unique request identifier
  • {{instanceId}} - Workflow instance identifier

Location: axiom-genesis-middleware/templates/approval-pending.html


3. Approval Pushback (approval-pushback.html)

Sent to request initiator when an approver sends the request back for revision.

Variables:

  • {{requestTitle}} - Title of the request
  • {{initiatorName}} - Name of the request initiator
  • {{pushedBackByName}} - Name of the approver who sent it back
  • {{pushedBackByEmail}} - Email of the approver
  • {{pushedBackAtLevel}} - Which approval level sent it back
  • {{totalLevels}} - Total number of approval levels
  • {{pushedBackAtLevelTitle}} - Title of the approval level
  • {{pushedBackAtTime}} - Date/time of pushback
  • {{pushbackReason}} - Detailed feedback/reason for revision request
  • {{formData}} - Original form data
  • {{reviseUrl}} - Link to open the form for revisions
  • {{revisionDeadline}} - Deadline for resubmitting revisions
  • {{requestId}} - Unique request identifier
  • {{instanceId}} - Workflow instance identifier

Location: axiom-genesis-middleware/templates/approval-pushback.html


4. Approval Rejected (approval-rejected.html)

Sent to request initiator when approval is rejected at any level.

Variables:

  • {{requestTitle}} - Title of the request
  • {{initiatorName}} - Name of the request initiator
  • {{rejectedByName}} - Name of the person who rejected
  • {{rejectedByEmail}} - Email of the person who rejected
  • {{rejectedAtLevel}} - Approval level where rejection occurred
  • {{totalLevels}} - Total number of approval levels
  • {{rejectedAtLevelTitle}} - Title of the rejecting level
  • {{rejectedAtTime}} - Date/time of rejection
  • {{rejectionReason}} - Detailed reason for rejection
  • {{formData}} - Original form data
  • {{approvalHistory}} - History of all approval actions taken
  • {{resubmitUrl}} - Link to submit a new request
  • {{requestId}} - Unique request identifier
  • {{instanceId}} - Workflow instance identifier

Location: axiom-genesis-middleware/templates/approval-rejected.html


Usage in Workflows

Template rendering in Workflow Engine

Templates are rendered with Handlebars syntax. The workflow engine processes these templates when sending notifications:

const notificationContext = {
requestTitle: "Purchase Order #12345",
initiatorName: "John Smith",
approverName: "Jane Doe",
formData: {
Amount: "$10,000",
Department: "Operations",
"Budget Code": "OP-2024-Q1",
},
approvalHistory: [
{
level: 1,
approver: { name: "Manager A", email: "manager.a@company.com" },
timestamp: "2024-01-15 10:30 AM",
action: "approve",
},
],
// ... other variables
};

Customization

To customize email templates:

  1. Modify the HTML file in axiom-genesis-middleware/templates/
  2. Preserve all Handlebars variables ({{variableName}})
  3. Adjust CSS styling as needed
  4. Test with sample data to ensure proper rendering

Email Service Integration

The templates are consumed by the email notification service in the middleware:

// Example service call (from notification/email.service.js)
const html = await templateEngine.render(
"approval-pending.html",
notificationVariables,
);
await emailService.send({
to: approverEmail,
subject: `Approval Needed: ${requestTitle}`,
html: html,
});

Best Practices

  • Keep templates HTML5 compliant for wide email client compatibility
  • Use inline CSS instead of external stylesheets for better email support
  • Test variables before deployment to ensure all required context is provided
  • Fallback values should be handled by the notification service if variables are missing
  • Responsive design - templates use max-width containers for mobile compatibility