➿ITL - ilert template language
The ITL enables you to customize and design alerts tailored to your specific use cases. In addition to offering flexibility in formatting and structuring alerts, it also provides a variety of built-in functions to further enhance the alerts' readablility.
In the UI's text mode, you may use the Insert data... dropdown to help you add template variables quickly - the text syntax works like this:
Type | Sample | Description |
---|---|---|
Text | Some text | You may, of course, add generic text content to your liking. |
Variable |
| Extract content of the event and insert it. Note: there is no further sanitizing of the values. |
Accessing nested variables |
| Access sub fields |
Accessing fields of an array |
| Access array contents |
Applying functions to variables |
| See Functions below, for a list of all functions. |
Passing arguments to functions |
| |
Sections (if/else blocks) | See Sections below. | |
Loops (for blocks) | See Loops below. |
Note that when rendering variables their content is not (HTML) escaped.
Functions
ITL allows you to apply functions for different use cases, such as string manipulation, date-time formatting, joining arrays. This flexibility makes it simple to handle text formatting, data extraction, and transformations, all within the same template.
Descriptions
Function | Description | Parameters |
---|---|---|
substring | Displays characters from the given start index(1) to the specified end index(2). (It is required to provide at least one parameter.) | substring(Integer(1)) substring(Integer(1), Integer(2)) |
lowerCase | Displays characters in lower case. | |
upperCase | Displays characters in upper case. | |
replaceAll | Replaces each of a given character sequence(1) with a new sequence(2). | replaceAll(String(1), String(2)) |
splitTakeAt | Divides a string into an array of substrings based on a character sequence as the delimiter. | splitTakeAt(String(1), Integer(2)) |
startsWithTake | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it matches. | startsWithTake(String(1), String(2)) |
equalsTake | Matches a given character sequence(1) with a variable's value and replaces it with a different character sequence(2) if it matches. | equalsTake(String(1), String(2)) |
endsWithTake | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it matches. | endsWithTake(String(1), String(2)) |
containsTake | Replaces a variable's value with a character sequence(2) if it contains a given character sequence(1). | containsTake(String(1), String(2)) |
startsWithTakeOrDrop | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it matches; otherwise, it does not display anything. | startsWithTakeOrDrop(String(1), String(2)) |
equalsTakeOrDrop | Matches a given character sequence(1) with a variable's value and replaces it with a different character sequence(2) if it matches; otherwise, it does not display anything. | equalsWithTakeOrDrop(String(1), String(2)) |
endsWithTakeOrDrop | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it matches; otherwise, it does not display anything. | endsWithTakeOrDrop(String(1), String(2)) |
containsTakeOrDrop | Replaces a variable's value with a character sequence(2) if it contains a given character sequence(1); otherwise, it does not display anything. | containsTakeOrDrop(String(1), String(2)) |
startsWithElse | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it doesn't match. | startsWithElse(String(1), String(2)) |
equalsElse | Matches a given character sequence(1) with the variable's value and replaces it with a different character sequence(2) if it doesn't match. | equalsElse(String(1), String(2)) |
endsWithElse | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it doesn't match. | endsWithElse(String(1), String(2)) |
containsElse | Replaces a variable's value with a character sequence(2) if it doesn't contain a given character sequence(1). | containsElse(String(1), String(2)) |
startsWithElseOrDrop | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | startsWithElseOrDrop(String(1), String(2)) |
equalsElseOrDrop | Matches a given character sequence(1) with the variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | equalsElseOrDrop(String(1), String(2)) |
endsWithElseOrDrop | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | endsWithElseOrDrop(String(1), String(2)) |
containsElseOrDrop | Matches a given character sequence(1) with a variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | containsElseOrDrop(String(1), String(2)) |
formatUnixMs | Formats a variable's value from milliseconds into ISO-8601 date-time format. Additionally, it accepts a format style character (1) as a parameter. Valid format characters are:
Any other character will lead to medium text style as default. | formatUnixMs() formatUnixMs(String(1)) |
formatUnixSec | Formats a variable's value from seconds into ISO-8601 date-time format. Additionally, it accepts a format style character (1) as a parameter. Valid format characters are:
Any other character will lead to medium text style as default. | formatUnixSec() formatUnixSec(String(1)) |
formatDateString | Formats a variable's value into ISO-8601 date format. Additionally, it accepts a format style character (1) as a parameter. Valid format characters are:
Any other character will lead to medium text style as default. | formatDateString() formatDateString(String(1)) |
join | Displays a text composed of array values joined by a given delimiter(1). If no delimiter is provided, the function defaults to | join() join(String(1)) |
joinFromObjectArray | Displays a text composed of object array(1) values joined by a given delimiter(2). If no delimiter is provided, the function defaults to a new line. | joinFromObjectArr(String(1)) joinFromObjectArr(String(1), String(2)) |
Examples
Function | Sample | Input data | Output |
---|---|---|---|
substring |
| result res | |
lowerCase |
| gavin belson from hooli | |
upperCase |
| GAVIN BELSON FROM HOOLI | |
replaceAll |
| Richard Hendricks owns Hooli | |
splitTakeAt |
| Richard Hendricks and Russ Hanneman are in the tres commas club | |
startsWithTake |
| In your dreams - Bertram Gilfoyle | |
equalsTake |
| Not true - Bertram Gilfoyle | |
endsWithTake |
| Flys - Bertram Gilfoyle | |
containsTake |
| Pied Piper rocks | |
startsWithTakeOrDrop |
| 1: 2: | 1: In your dreams - Bertram Gilfoyle 2: |
equalsTakeOrDrop |
| 1: 2: | 1: Not true - Bertram Gilfoyle 2: |
endsWithTakeOrDrop |
| 1: 2: | 1: Flys - Bertram Gilfoyle 2: |
containsTakeOrDrop |
| 1: 2: | 1: Pied Piper rocks 2: |
startsWithElse |
|
1. 2: | 1: I am the best software engineer at Pied Piper - Dinesh Chugtai 2: In your dreams - Bertram Gilfoyle |
equalsElse |
| 1: 2: | 1: I am better than Gilfoyle - Dinesh Chugtai 2: Not true - Bertram Gilfoyle |
endsWithElse |
| 1: 2: | 1: I am the fastest coder - Dinesh Chugtai 2: Flys - Bertram Gilfoyle |
containsElse |
| 1: 2: | 1: Hooli rocks 2: Pied Piper rocks |
startsWithElseOrDrop |
| 1. 2: | 1: 2: In your dreams - Bertram Gilfoyle |
equalsElseOrDrop |
| 1: 2: | 1: 2: Not true - Bertram Gilfoyle |
endsWithElseOrDrop |
| 1: 2: | 1: 2: Flys - Bertram Gilfoyle |
containsElseOrDrop |
| 1: 2: | 1: 2: Pied Piper rocks |
formatUnixMs |
| 1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM | |
formatUnixSec |
| 1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM | |
formatDateString |
| 1: May 25, 2021, 9:24:56 PM 2: 5/25/21, 9:24 PM | |
join |
| 1: PiedPiper, Hooli, "Aviato" 2: PiedPiper- Hooli- Aviato | |
joinFromObjectArray |
| 1: PiedPiper Hooli NewPiedPiper Raviga 2: PiedPiper+Hooli+NewPiedPiper+Raviga |
Blocks
The ITL also supports block based sections and loops, providing flexibility in handling complex templates and varying data sets efficiently.
Sections [if]
Sections allow for conditional rendering, where specific content is displayed only if a certain value exists or meets a given condition. Positive conditions check if a value is present or true
, while inverted conditions render content when the value is false
or missing.
A section begins with a hash #
and ends with a slash /
.
Using the following context:
Inverted sections [else]
Inverted sections only render content based on the inverse value of a context key.
An inverted section begins with a caret ^
and ends with a slash /
. Example:
Using the following context:
Loops [for]
Loops allow to iterate over each item of a list or array of data and display render them as text.
ITL functions are only applicable to absolute variable keys, therefore they cannot be used on the relative variable keys generated by loop blocks. While they are still resolved inside of the block, their content is repeated which each loop iteration.
A loop is written in the same way as a section. It begins with a hash #
and ends with a slash /
. Inside the loop, you place the key that represents the list or array item to be iterated over.
Using the following context:
Last updated