Expert Guide

Advanced configuration for AI optimizers and complex systems.

Message Templates

Message templates allow you to customize email and SMS notifications sent by Fentrica. Templates use the Handlebars templating engine with additional custom helpers for advanced logic.

Accessing Message Templates

Message templates are managed in Organization Settings:

  1. Navigate to Organization in the main menu
  2. Scroll to the Message Templates section
  3. Click on a template to edit, or create a new one

Template Types

Fentrica supports the following message template types:

Access & Authentication

TypeDescription
Access PIN E-mailPIN code delivery via email to Access Group Users
Access PIN SMSPIN code delivery via SMS to Access Group Users
Access App Invitation E-mailApp invitation via email to Access Group Users
Access App Invitation SMSApp invitation via SMS to Access Group Users

Task Notifications (to Service Providers)

TypeDescription
Task Assigned E-mailNotification when a task is assigned
Task Updated E-mailNotification when a task receives comments
Next Week Tasks E-mailWeekly summary of upcoming tasks
Task Closed E-mailNotification when a task is closed

Maintenance Request Notifications (to Reporters)

TypeDescription
Maintenance Request Commented E-mailNotification when a request receives comments
Maintenance Request Resolved E-mailNotification when a request is resolved
Maintenance Request Closed E-mailNotification when a request is closed

Automation

TypeDescription
General Automation TemplateCustom templates for rule-based automations

Template Fields

Each template has the following configurable fields:

FieldDescriptionEmailSMS
NameTemplate identifierYesYes
TypeTemplate type (see above)YesYes
BodyPlain text message contentYesYes
HTML BodyRich HTML contentYesNo
SubjectEmail subject lineYesNo
From NameSender display nameYesYes
Reply-to NameReply-to display nameYesNo
Reply-to AddressReply-to email addressYesNo

Template Syntax

Templates use Handlebars syntax. Variables are inserted using double curly braces.

Basic Variable Insertion

Hello {{user.firstname}} {{user.lastname}}!

Your access PIN is: {{user.pin}}

Conditional Blocks

{{#if user.title}}
Dear {{user.title}} {{user.lastname}},
{{else}}
Dear {{user.firstname}},
{{/if}}

Iterating Over Arrays

{{#each tasks}}
- {{this.name}}: {{this.description}}
{{/each}}

Available Variables

Variables can be injected into templates using {{variable}} syntax. Available variables depend on the context of the message.

User Variables

VariableDescription
user.firstnameUser's first name
user.lastnameUser's last name
user.titleUser's title
user.emailUser's email address
user.phoneUser's phone number
user.pinUser's access PIN code

Organization Variables

VariableDescription
org.nameOrganization name
org.aliasOrganization alias
org.regnoRegistration number
org.vatnoVAT number
org.streetStreet address
org.zipPostal code
org.cityCity
org.stateState/Province
org.countryCountry

Access Group Variables

VariableDescription
accessGroup.nameAccess group name

Property & Unit Variables

VariableDescription
property.nameProperty name
property.timezoneProperty timezone
unit.nameUnit name

Alarm Variables

VariableDescription
alarm.priorityAlarm priority level
alarm.classAlarm classification
alarm.sourceAlarm source
alarm.stateCurrent alarm state
alarm.activatedAtActivation timestamp
alarm.resolvedAtResolution timestamp
deviceAlarmDefinition.nameDevice alarm name
deviceAlarmDefinition.descriptionDevice alarm description
deviceAlarmDefinition.nodeIdDevice node ID
analyticAlarmDefinition.nameAnalytic alarm name
analyticAlarmDefinition.descriptionAnalytic alarm description

Some variables may be undefined if the associated resource is not attached to the message job. Always use conditional blocks when a variable might not be present.

Custom Helpers

Fentrica extends Handlebars with additional helper functions for advanced template logic.

Comparison Helper

The compare helper allows comparing two values with various operators.

Syntax: {{#if (compare value1 "operator" value2)}}...{{/if}}

Supported operators: ==, ===, !=, !==, <, <=, >, >=

{{#if (compare alarm.priority ">" 3)}}
URGENT: This is a high priority alarm!
{{/if}}

{{#if (compare alarm.state "==" "active")}}
Alarm is currently active.
{{/if}}

Logical Operators

Or Helper

Returns true if ANY of the arguments are truthy.

{{#if (or user.email user.phone)}}
We can contact you via {{user.email}}{{user.phone}}
{{/if}}

And Helper

Returns true if ALL of the arguments are truthy.

{{#if (and user.firstname user.lastname)}}
Full name: {{user.firstname}} {{user.lastname}}
{{/if}}

Array Helpers

Index Helper

Get an element at a specific index from an array.

Syntax: {{index array position}}

First item: {{index items 0}}
Second item: {{index items 1}}

Last Helper

Get the last element from an array.

Syntax: {{last array}}

Most recent: {{last readings}}

String Helpers

Split Helper

Split a string by a delimiter, returning an array.

Syntax: {{split string "delimiter"}}

{{#each (split address ",")}}
{{this}}
{{/each}}

Trim Helper

Remove leading and trailing whitespace from a string.

Syntax: {{trim string}}

Name: {{trim user.firstname}}

Number Helpers

ToNumber Helper

Convert a value to a number.

Syntax: {{toNumber value}}

{{#if (compare (toNumber stringValue) ">" 100)}}
Value exceeds 100
{{/if}}

Between Helper

Check if a value falls between a minimum and maximum (inclusive).

Syntax: {{#if (between value min max)}}...{{/if}}

{{#if (between temperature 18 24)}}
Temperature is in comfortable range.
{{else}}
Temperature is outside comfortable range!
{{/if}}

Examples

Access PIN Email

Dear {{user.firstname}},

Welcome to {{org.name}}!

Your access credentials for {{accessGroup.name}}:
PIN Code: {{user.pin}}

Best regards,
{{org.name}}

Alarm Notification

{{#if deviceAlarmDefinition.name}}
Alarm: {{deviceAlarmDefinition.name}}
{{/if}}
{{#if analyticAlarmDefinition.name}}
Alarm: {{analyticAlarmDefinition.name}}
{{/if}}

Priority: {{alarm.priority}}
{{#if (compare alarm.priority ">=" 4)}}
⚠️ This is a HIGH PRIORITY alarm requiring immediate attention!
{{/if}}

Status: {{alarm.state}}
Triggered: {{alarm.activatedAt}}
{{#if alarm.resolvedAt}}
Resolved: {{alarm.resolvedAt}}
{{/if}}

Property: {{property.name}}

Task Assignment with Conditional Logic

Hello {{user.firstname}},

A new task has been assigned to you.

Task: {{task.name}}
{{#if task.description}}
Description: {{task.description}}
{{/if}}

{{#if (and task.dueDate (compare task.priority ">" 3))}}
⚠️ This is a high-priority task due on {{task.dueDate}}.
{{/if}}

Property: {{property.name}}
{{#if unit.name}}
Unit: {{unit.name}}
{{/if}}

Using String Manipulation

{{#with (split sensor.location "/")}}
Building: {{index this 0}}
Floor: {{index this 1}}
Room: {{last this}}
{{/with}}