Rootly built-in

find

  • find: arg1, 'arg2'
    • arg1. String
    • arg2. String
JS
// Pretending object is the following object [{"id": "apple"}, {"id": "banana"}]
{{ object | find: 'id', 'banana' }}
// Output
// {"id": "banana"}

get

  • get: 'arg'
    • arg. String
JS
// Pretending object is the following object {"id": "id", "incident": {"title": "Something is on fire!"}}
{{ object | get: 'incident.title' }}
// Output
// Something is on fire!

smart_date

JS


{{ 'now' | smart_date: 'tomorrow' }}
// Output
// 2023-06-29 12:00:00 -0700

date_add

  • date_add: amount, 'date_part'
    • amount. Integer (positive to add, negative to subtract)
    • date_part. String - one of: year, month, day, hour, minute, second, millisecond (plurals supported)
Adds a specified amount of time to a date. Works with ‘now’, ‘today’, ISO date strings, Time, and Date objects.
JS
{{ 'now' | date_add: 1, 'day' | date: '%Y-%m-%d' }}
// Output
// 2023-06-30 (tomorrow)

{{ '2023-06-29T10:30:00Z' | date_add: 2, 'hours' | date: '%Y-%m-%d %H:%M' }}
// Output  
// 2023-06-29 12:30

{{ incident.target_resolve_date | date_add: -30, 'minutes' }}
// Output
// 30 minutes before the target resolve date

date_minus

  • date_minus: amount, 'date_part'
    • amount. Integer (positive to subtract, negative to add)
    • date_part. String - one of: year, month, day, hour, minute, second, millisecond (plurals supported)
Subtracts a specified amount of time from a date. Works with ‘now’, ‘today’, ISO date strings, Time, and Date objects.
JS
{{ 'now' | date_minus: 7, 'days' | date: '%Y-%m-%d' }}
// Output
// 2023-06-22 (a week ago)

{{ incident.created_at | date_minus: 1, 'hour' | date: '%Y-%m-%d %H:%M' }}
// Output
// 1 hour before the incident was created

{{ 'today' | date_minus: 6, 'months' }}
// Output
// 6 months ago

slice

  • slice: '\*arg'
    • arg. String
    • … As many args as you need
JS


// Pretending object is the following object {"key": "hello", "value": "world", "foo": "bar"}

{{ object | slice: 'key' }}

// Output
// {"key": "hello"}

{{ object | slice: 'key', 'foo' }}

// Output
// {"key": "hello", "foo": "bar"}

flatten

  • flatten
JS

// Pretending object is the following object \["1", "2", \["3"\]\]
{{ object | flatten }}
// Output
// \["1","2","3"\]

to_values

  • to_values: 'key'
    • key is optional
JS

// Pretending object is the following object {"key": "hello", "value": "world"}
{{ object | to_values }}

// Output
// \[{"value":"world"}\]

{{ object | to_values: 'key' }}

// Output
// \[{"value":"hello"}\]

to_json

  • to_json
JS
// Pretending object is the following object [{"key": "hello", "value": "world"}]
{{ object | to_json }}
// Output
// [{"key":"hello","value":"world"}]

to_iso8601

  • to_iso8601
JS
// Pretending object is the following datetime
{{ object | to_iso8601 }}
// Output
// 2023-06-29T12:00:00-07:00

distance_of_time_in_words

  • distance_of_time_in_words: 'arg', 'precise'
    • arg. String (optional)
    • precise. String (optional)
JS
{{ 3720 | distance_of_time_in_words }}
// Output
// about 1 hour
{{ 3720 | distance_of_time_in_words: 0, 'precise' }}
// Output
// 1 hour and 2 minutes
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020' }}
// Output
// about 1 month
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020', 'precise' }}
// Output
// 4 weeks and 2 days

distance_of_time_in_words_to_now

  • distance_of_time_in_words_to_now: 'precise'
    • precise. String (optional)
JS
{{ 'May 1, 2020' | distance_of_time_in_words_to_now }}
// Output
// over 2 years
{{ 'May 1, 2020' | distance_of_time_in_words_to_now: 'precise' }}
// Output
// 2 years and 7 months

in_time_zone

  • in_time_zone: 'time_zone'
    • time_zone. Any timezone listed in Timezones
JS

{{ now | in_time_zone: 'Europe/London' | date: '%Y-%m-%d %H:%M %Z' }}
See Timezones for available values

to_utc

  • to_utc
Converts a date to UTC timezone. Works with ‘now’, ‘today’, ISO date strings, Time, and Date objects.
JS
{{ incident.started_at | to_utc | date: '%Y-%m-%d %H:%M:%S' }}
// Output
// 2023-06-29 15:30:00 (converted to UTC)

{{ 'now' | to_utc | date: '%Y-%m-%d %H:%M:%S UTC' }}
// Output  
// 2023-06-29 19:45:23 UTC

{{ '2023-06-29T10:30:00-05:00' | to_utc | date: '%Y-%m-%d %H:%M:%S' }}
// Output
// 2023-06-29 15:30:00
Useful for synchronizing incident timestamps with timeline values, ensuring all dates display in UTC regardless of user timezone.

to_table

  • to_table: 'table_type', 'title', 'time_zone', 'format'
    • table_type is either events or action_items
    • time_zone. Any timezone listed in Timezones
    • format can be ascii , markdown , html, atlassian_markdown
JS

{{ incident.events | to_table: 'events', 'Hello world', 'America/Los_Angeles', 'markdown' }}

regex_replace

Global replace
  • regex_replace: 'regex', 'replacement'
    • regexp a ruby regular expression
    • replacement a ruby regular expression
JS
{{ 'foo bar 123 456' | regex_replace: '\d+', 'baz' }}
// Output
// foo bar baz baz

regex_replace_first

First match replace
  • regex_replace_first: 'regex', 'replacement'
    • regexp a ruby regular expression
    • replacement a ruby regular expression
JS
{{ 'foo bar 123 456' | regex_replace: '\d+', 'baz' }}
// Output
// foo bar baz 456

regex_remove

Global match remove
  • regex_remove: 'regex'
    • regexp a ruby regular expression
JS
{{ 'foo bar 123 456' | regex_remove: '\d+' }}
// Output
// foo bar

regex_remove_first

First match remove
  • regex_remove_first: 'regex'
    • regexp a ruby regular expression
JS
{{ 'foo bar 123 456' | regex_remove_first: '\d+' }}
// Output
// foo bar  456

regex_match

Find first match and return array with full match and capture groups
  • regex_match: 'regex', 'flags'
    • regex a ruby regular expression
    • flags optional string with regex flags: ‘i’ (case insensitive), ‘m’ (multiline), ‘x’ (extended)
JS
{{ 'Key1: value1' | regex_match: 'Key(\d+): (.+)' | first }}
// Output
// Key1: value1

{{ 'Key1: value1' | regex_match: 'Key(\d+): (.+)' | last }}
// Output  
// value1

{{ 'user@example.com' | regex_match: '(\w+)@(\w+\.\w+)' | size }}
// Output
// 3 (full match + 2 capture groups)
JS
// Case insensitive matching
{{ 'HELLO world' | regex_match: 'hello', 'i' | first }}
// Output
// HELLO

// Multiline matching  
{{ "Line 1\nLine 2\nDone" | regex_match: 'line.*done', 'im' | first }}
// Output
// Line 1
// Line 2  
// Done
Perfect for extracting data from email alert payloads:
JS
{{ alert.body | regex_match: 'Severity: (.+)' | last }}
// Extract severity level from alert body

{{ alert.body | regex_match: 'Host: ([\w\.-]+)' | last }}  
// Extract hostname from alert

regex_match_all

Find all matches and return array of results
  • regex_match_all: 'regex', 'flags'
    • regex a ruby regular expression
    • flags optional string with regex flags: ‘i’ (case insensitive), ‘m’ (multiline), ‘x’ (extended)
JS
{{ 'foo 123 bar 456 baz 789' | regex_match_all: '\d+' | size }}
// Output
// 3

{{ 'foo 123 bar 456 baz 789' | regex_match_all: '\d+' | first }}
// Output
// 123

{{ 'foo 123 bar 456 baz 789' | regex_match_all: '\d+' | last }}
// Output  
// 789
JS
// Extract all email addresses
{{ 'Contact support@example.com or admin@test.org' | regex_match_all: '[\w\.-]+@[\w\.-]+\.\w+' | size }}
// Output
// 2

// Case insensitive matching
{{ 'ERROR: failed, error: timeout' | regex_match_all: 'error: (\w+)', 'i' | first }}
// Output
// failed
Ideal for parsing multiple values from alert payloads:
JS
// Extract all IP addresses from alert body
{{ alert.body | regex_match_all: '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b' }}

// Extract all key-value pairs
{{ alert.body | regex_match_all: 'Key\d+: ([^\n]+)' }}

dasherize

  • dasherize
JS
{{ 'hello_world' | dasherize }}
// Output
// hello-world

parameterize

  • parameterize
    • separator (default to ’-‘)
JS
{{ 'Hello World' | parameterize }}
// Output
// hello-world
{{ 'Hello World' | parameterize: '_' }}
// Output
// hello_world

camelize

  • camelize
JS
{{ 'hello world' | camelize }}
// Output
// Hello world

titleize

  • titleize
JS

{{ 'hello world' | titleize }}
// Output
// Hello World

singularize

  • singularize
JS
{{ 'cars' | singularize }}
// Output
// car

pluralize

  • pluralize
JS
{{ 'car' | pluralize }}
// Output
// cars

humanize

  • humanize
JS
{{ '0' | humanize }}
// Output
// No
{{ '1' | humanize }}
// Output
// Yes
{{ 'incident_management' | humanize }}
// Output
// Incident Management

shuffle

  • shuffle
JS
{{ '123456789' | shuffle }}
// Output
// 973426581

Liquid built-in

html_to_markdown

  • html_to_markdown
Converts HTML content to Markdown format. Handles most common HTML elements including headings, paragraphs, lists, links, code blocks, and tables.
JS
{{ '<h1>Title</h1><p>This is <strong>bold</strong> text.</p>' | html_to_markdown }}
// Output
// # Title
// 
// This is **bold** text.
JS
{{ '<ul><li>Item 1</li><li>Item 2</li></ul>' | html_to_markdown }}
// Output
// - Item 1
// - Item 2
Returns empty string for nil or empty input. Preserves original HTML on conversion errors.

shortener

  • shortener
JS
{{ 'https://rootly.com/account/incidents/123456' | shortener }}
// Output
// https://root.ly/1234