Skip to main content
How to customize Rule Engine alert titles and emails

A quick guide to customize the titles of the monitoring alerts and the content of the email notifications sent by the Rule Engine.

Updated over a year ago

The Railgenius Rule Engine allows you to sent customized emails associated with an alert triggered by a rule. You will receive an email when the alert opens and you can choose to receive a second one when the alert closes.

Introduction

As a Railnova administrator within your company, you are able to set dynamic content for the alert title, the notification email subject, as well as the notification email body.

You can also set a different title and email body for the closing alert and notification.

Editor

To make editing easier, you can see that the dynamic texts are colour-coded and the lines are numbered:

Custom text for the close alert title, dynamic text for the close email body

Note that if there's a syntax error in the blue dynamic text, it becomes red so you can see exactly what you need to correct.

Open Alert Title and Email Subject

The default text for the alert title is the rule's name followed by the name of the asset:

The default alert title is dynamic!


If you decide to send notification emails, this will also be the email's subject line by default.

It's also possible to use other available fields, for instance an inside_workshop message:

This alert uses a field from the inside_workshop message


Please note that you can write an Open alert title on multiple lines, but as soon as you save your new alert, all line breaks will be replaced with spaces and the text will be displayed on a single line.

Open Alert Email Body

You can also add dynamic text to the body of the email that is sent when an alert opens.

By default, the email text will show the following information:

Default text template


You can of course customize the text as needed and add as much information as you want.

This is an example of a customized email in German with a longer text and dynamic content:

Custom template in German about the battery_warning_level message


Please note that a footer will always be displayed at the bottom of each email notification in the language of the email's recipient.

This footer includes information about the name and ID of the rule and cannot be modified.


Close Email Subject and Body

If you'd like to receive an email when the alert closes, please check the box "Send notification email when closing". You will then have the possibility to customize the closing alert title and notification email as well.

By default the email subject and body are set as follows:

Shown only if "Send notification email when closing" is checked


Like for the open alert email, you can modify the email subject and body and add as much text and dynamic content as you need:

Custom template in French about the battery_warning_level message

To test if a symbol is present (and if it is, show its value), you can use the {% if %} and {% endif %} tags.

For instance, if the location field exists in the last battery_critical_level message and this location is known, the email will display the latest battery level as well as the last location of the asset.

You can simply add the location like this:

Or include it in a sentence like this:

Variables

You can use a set of variables in the alert title and/or in the email body.

Message

The message variable is the message that triggered the alert opening or closing. It has many properties, such as type, content or timestamp.

For instance, to display the type of the triggering message :

{{ message.type }}

Here is a list of the different message variables:

  • message.type: the message's type

  • message.content: JSON content

  • message.client: the identifier of the company this message originates from (if any)

  • message.locomotive: the identifier of the locomotive this message originates from (if any)

  • message.asset: the asset identifier

  • message.device: the device identifier

  • message.timestamp: the date and time at which the message was emitted

  • message.recv_time: the date and time at which the message was received

  • message.processed_time: the date and time at which the message was processed

  • message.is_open: the message status, as an alert (True or False)

  • message.close_time: the closing time of the message

Asset

The asset variable represents the asset for which the alert was triggered. It has such properties as name, class, etc. If you want to display the name of the asset in the alert, you can include the following dynamic content:

{{ asset.name }}

Here is a list of the different asset variables:

  • asset.rid: is identifier

  • asset.name: its name

  • asset.class_name : the class name

  • asset.ecm_id : the ECM identifier

Rule

Similarly, the rule variable represents the rule that triggered the alert opening or closing. It has such properties as name, description, etc.

If you'd like to display the rule name in the alert, you can include the following variable:

{{ rule.name }}

Here is a list of the different rule variables:

  • rule.name: the rule's name

  • rule.description: the rule's description text

  • rule.help_url: the URL linking to help about this rule

  • rule.priority_label: the rule's priority label, in the recipient's language

Fields by Message Types

Last but not least, one variable is available for each type of message that is used in the rule's conditions.

If your rule has a condition on fault codes event_cat_data_link_3500b, you can include the following dynamic content to display the description of the fault code that triggered the alert:

{{ event_cat_data_link_3500b.description }}

Note that all the variables of the default position message type are available too, even if it is not used in the rule's conditions.

So, if you want to display the location at which the rule's condition was met, you can add this:

{{ position.location }}

Tags

We also added a few tags in order to support this new feature. These tags are like instructions to display specific content.

Here is the list of the tags that you can add to your email body as needed.

Display the date and time in the recipient's local timezone:

{% display_date message.timestamp %}

Display the snapshot of values for all message symbols that have data configuration (ie: what's included in the email's body by default):

{% snapshot_text %}

Link to the Data Inspector page and the relevant data (note that the Data Inspector displays the data with a time window of 5 minutes before and after the alert):

{% data_inspector_url %}

Link to the Telematics page and the relevant data (note that the Telematics page displays the data with a time window of 5 minutes before and after the alert):

{% telematics_url %}

Link to the History page and the relevant data:

{% map_history_url %}

To show conditional content if a symbol is present, use the if / endif tags:

{% if battery_critical_level.location %}Location: {{ battery_critical_level.location }}{% endif %}

Support

Do you still have questions? Go to the Railnova platform and click "Contact us" for help!

Did this answer your question?