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:

TypeSampleDescription

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)

{{ #var }}
true
{{ /var }}
{{ ^var }}
false
{{ /var }}

See Sections below.

Loops (for blocks)

{{ #array }}
{{ firstName }} {{ lastName }}
{{ /array }}

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

FunctionDescriptionParameters

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:

  • 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

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:

  • 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

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:

  • 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

FunctionSampleInput dataOutput

substring

{{ var.substring(3) }} {{ var.substring(5, 7) }}

{
    "var": "Test result"
}

result res

lowerCase

{{ var.lowerCase() }}

{
    "var": "Gavin Belson from Hooli"
}

gavin belson from hooli

upperCase

{{ var.upperCase() }}

{
    "var": "Gavin Belson from Hooli"
}

GAVIN BELSON FROM HOOLI

replaceAll

{{ var.replaceAll("Gavin Belson", "Richard Hendricks") }}

{
    "var": "Gavin Belson owns Hooli"
}

Richard Hendricks owns Hooli

splitTakeAt

{{ var.splitTakeAt("Belson, ", 1) }}

{
    "var": "Gavin Belson, Richard Hendricks and Russ Hanneman are in the tres commas club"
}

Richard Hendricks and Russ Hanneman are in the tres commas club

startsWithTake

{{ var.startsWithTake("I am the best", "In your dreams - Bertram Gilfoyle") }}

{
    "var": "I am the best software engineer at Pied Piper - Dinesh Chugtai"
}

In your dreams - Bertram Gilfoyle

equalsTake

{{ var.equalsTake("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}

{
    "var": "I am better than Gilfoyle - Dinesh Chugtai"
}

Not true - Bertram Gilfoyle

endsWithTake

{{ var.endsWithTake("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}

{
    "var": "I am the fastest coder - Dinesh Chugtai"
}

Flys - Bertram Gilfoyle

containsTake

{{ var.containsTake("rocks", "Pied Piper rocks") }}

{
    "var": "Hooli rocks"
}

Pied Piper rocks

startsWithTakeOrDrop

{{ var.startsWithTakeOrDrop("I am the best", "In your dreams - Bertram Gilfoyle") }}

1:

{
    "var": "I am the best software engineer at Pied Piper - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: In your dreams - Bertram Gilfoyle 2:

equalsTakeOrDrop

{{ var.equalsTakeOrDrop("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}

1:

{
    "var": "I am better than Gilfoyle - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: Not true - Bertram Gilfoyle 2:

endsWithTakeOrDrop

{{ var.endsWithTakeOrDrop("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}

1:

{
    "var": "I am the fastest coder - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: Flys - Bertram Gilfoyle 2:

containsTakeOrDrop

{{ var.containsTakeOrDrop("rocks", "Pied Piper rocks") }}

1:

{
    "var": "Hooli rocks"
}

2:

{
    "var": "Pied Piper"
}

1: Pied Piper rocks 2:

startsWithElse

{{ var.startsWithElse("I am the best", "In your dreams - Bertram Gilfoyle") }}

1.

{
    "var": "I am the best software engineer at Pied Piper - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

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:

{
    "var": "I am better than Gilfoyle - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: I am better than Gilfoyle - Dinesh Chugtai 2: Not true - Bertram Gilfoyle

endsWithElse

{{ var.endsWithElse("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}

1:

{
    "var": "I am the fastest coder - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: I am the fastest coder - Dinesh Chugtai 2: Flys - Bertram Gilfoyle

containsElse

{{ var.containsElse("rocks", "Pied Piper rocks") }}

1:

{
    "var": "Hooli rocks"
}

2:

{
    "var": "Pied Piper"
}

1: Hooli rocks 2: Pied Piper rocks

startsWithElseOrDrop

{{ var.startsWithElseOrDrop("I am the best", "In your dreams - Bertram Gilfoyle") }}

1.

{
    "var": "I am the best software engineer at Pied Piper - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: 2: In your dreams - Bertram Gilfoyle

equalsElseOrDrop

{{ var.equalsElseOrDrop("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }}

1:

{
    "var": "I am better than Gilfoyle - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: 2: Not true - Bertram Gilfoyle

endsWithElseOrDrop

{{ var.endsWithElseOrDrop("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }}

1:

{
    "var": "I am the fastest coder - Dinesh Chugtai"
}

2:

{
    "var": "Pied Piper"
}

1: 2: Flys - Bertram Gilfoyle

containsElseOrDrop

{{ var.containsElseOrDrop("rocks", "Pied Piper rocks") }}

1:

{
    "var": "Hooli rocks"
}

2:

{
    "var": "Pied Piper"
}

1: 2: Pied Piper rocks

formatUnixMs

{{ var.formatUnixMs() }} {{ var.formatUnixMs("S") }}

{
    "ms": 1674950737000
}

1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM

formatUnixSec

{{ var.formatUnixSec() }} {{ var.formatUnixSec("S") }}

{
    "sec": 1674950737
}

1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM

formatDateString

{{ var.formatDateString() }} {{ var.formatDateString("S") }}

{
    "str": "2021-05-25T21:24:56.771Z"
}

1: May 25, 2021, 9:24:56 PM 2: 5/25/21, 9:24 PM

join

{{ var.join() }} {{ var.join("- ") }}

{
    "array": ["PiedPiper", "Hooli", "Aviato"]
}

1: PiedPiper, Hooli, "Aviato" 2: PiedPiper- Hooli- Aviato

joinFromObjectArray

{{ companies.joinFromObjectArr("name") }} {{ companies.joinFromObjectArr("ceo", "+") }}

{
    "companies": [
        {
            "name": "PiedPiper",
            "ceo": "Richard Hendricks"
        },
        {
            "name": "Hooli",
            "ceo": "Gavin Belson"
        },
        {
            "name": "NewPiedPiper",
            "ceo": "Jian-Yang"
        },
        {
            "name": "Raviga",
            "ceo": "Peter Gregory"
        }
    ]
}

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 /.


{{ #isTrue }}
Hello
{{ /isTrue }}
World!

Using the following context:

{
    "isTrue": true,
    "isFalse": false
}
Hello World!

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:

Hello

{{ #isTrue }}
World!
{{ /isTrue }}
{{ ^isTrue }}
Tim!
{{ /isTrue }}

Using the following context:

{
    "isTrue": true,
    "isFalse": false
}
Hello World!

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.


{{ #simple }}
{{.}}
{{ /simple }}

Using the following context:

{
    "simple": ["Pied Piper", "Hooli", "Raviga"],
    "nested": [
        { "name": "Richard Hendricks" },
        { "name": "Gavin Belson" },
        { "name": "Peter Gregory" }
    ]
}
Pied Piper
Hooli
Raviga

Last updated