➿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:
Text
Some text
You may, of course, add generic text content to your liking.
Variable
{{
var
}}
Extract content of the event and insert it. Note: there is no further sanitizing of the values.
Accessing nested variables
{{ var
.
subfield
.
evenMore }}
Access sub fields
Accessing fields of an array
{{ var.arrayField
[0]
.more }}
Access array contents
Applying functions to variables
{{var.lowerCase
()
}}
See Functions below, for a list of all functions.
Passing arguments to functions
{{var.splitTakeAt(
"one two", 10
)}}
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
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
F: Full text style (Sunday, January 29, 2023 at 12:05:37 AM Coordinated Universal Time)
L: Long text style(January 29, 2023 at 12:05:37 AM UTC)
M: Medium text style(Jan 29, 2023, 12:05:37 AM)
S: Short text style(1/29/23, 12:05 AM)
Any other character will lead to medium text style as default.
formatUnixMs() formatUnixMs(String(1))
formatUnixSec
F: Full text style (Sunday, January 29, 2023 at 12:05:37 AM Coordinated Universal Time)
L: Long text style(January 29, 2023 at 12:05:37 AM UTC)
M: Medium text style(Jan 29, 2023, 12:05:37 AM)
S: Short text style(1/29/23, 12:05 AM)
Any other character will lead to medium text style as default.
formatUnixSec() formatUnixSec(String(1))
formatDateString
F: Full text style (Sunday, January 29, 2023 at 12:05:37 AM Coordinated Universal Time)
L: Long text style(January 29, 2023 at 12:05:37 AM UTC)
M: Medium text style(Jan 29, 2023, 12:05:37 AM)
S: Short text style(1/29/23, 12:05 AM)
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
substring
{{ var.substring(3) }}
{{ var.substring(5, 7) }}
result res
lowerCase
{{ var.lowerCase() }}
gavin belson from hooli
upperCase
{{ var.upperCase() }}
GAVIN BELSON FROM HOOLI
replaceAll
{{ var.replaceAll("Gavin Belson", "Richard Hendricks") }}
Richard Hendricks owns Hooli
splitTakeAt
{{ var.splitTakeAt("Belson, ", 1) }}
Richard Hendricks and Russ Hanneman are in the tres commas club
startsWithTake
{{ var.startsWithTake("I am the best", "In your dreams - Bertram Gilfoyle") }}
In your dreams - Bertram Gilfoyle
equalsTake
{{ var.equalsTake("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}
Not true - Bertram Gilfoyle
endsWithTake
{{ var.endsWithTake("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}
Flys - Bertram Gilfoyle
containsTake
{{ var.containsTake("rocks", "Pied Piper rocks") }}
Pied Piper rocks
startsWithTakeOrDrop
{{ var.startsWithTakeOrDrop("I am the best", "In your dreams - Bertram Gilfoyle") }}
1:
2:
1: In your dreams - Bertram Gilfoyle 2:
equalsTakeOrDrop
{{ var.equalsTakeOrDrop("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}
1:
2:
1: Not true - Bertram Gilfoyle 2:
endsWithTakeOrDrop
{{ var.endsWithTakeOrDrop("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}
1:
2:
1: Flys - Bertram Gilfoyle 2:
containsTakeOrDrop
{{ var.containsTakeOrDrop("rocks", "Pied Piper rocks") }}
1:
2:
1: Pied Piper rocks 2:
startsWithElse
{{ var.startsWithElse("I am the best", "In your dreams - Bertram Gilfoyle") }}
1.
2:
1: I am the best software engineer at Pied Piper - Dinesh Chugtai 2: In your dreams - Bertram Gilfoyle
equalsElse
{{ var.equalsElse("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}
1:
2:
1: I am better than Gilfoyle - Dinesh Chugtai 2: Not true - Bertram Gilfoyle
endsWithElse
{{ var.endsWithElse("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}
1:
2:
1: I am the fastest coder - Dinesh Chugtai 2: Flys - Bertram Gilfoyle
containsElse
{{ var.containsElse("rocks", "Pied Piper rocks") }}
1:
2:
1: Hooli rocks 2: Pied Piper rocks
startsWithElseOrDrop
{{ var.startsWithElseOrDrop("I am the best", "In your dreams - Bertram Gilfoyle") }}
1.
2:
1: 2: In your dreams - Bertram Gilfoyle
equalsElseOrDrop
{{ var.equalsElseOrDrop("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}
1:
2:
1: 2: Not true - Bertram Gilfoyle
endsWithElseOrDrop
{{ var.endsWithElseOrDrop("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}
1:
2:
1: 2: Flys - Bertram Gilfoyle
containsElseOrDrop
{{ var.containsElseOrDrop("rocks", "Pied Piper rocks") }}
1:
2:
1: 2: Pied Piper rocks
formatUnixMs
{{ var.formatUnixMs() }}
{{ var.formatUnixMs("S") }}
1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM
formatUnixSec
{{ var.formatUnixSec() }}
{{ var.formatUnixSec("S") }}
1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM
formatDateString
{{ var.formatDateString() }}
{{ var.formatDateString("S") }}
1: May 25, 2021, 9:24:56 PM 2: 5/25/21, 9:24 PM
join
{{ var.join() }}
{{ var.join("- ") }}
1: PiedPiper, Hooli, "Aviato" 2: PiedPiper- Hooli- Aviato
joinFromObjectArray
{{ companies.joinFromObjectArr("name") }}
{{ companies.joinFromObjectArr("ceo", "+") }}
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