Skip to main content

Expressions Reference

String

base64_decode(thing)

Base64 decode an expression

Example 1: Return Base64 decoded string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "hello world" when used with the following context:

%{"text" => %{"__value__" => "aGVsbG8gd29ybGQ=", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = base64_decode(text)
# When used in a piece of text prefix it with an `@`
my_var = "@base64_decode(text)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "hello world".

card MyCard do
my_var = base64_decode("aGVsbG8gd29ybGQ=")
# When used in a piece of text prefix it with an `@`
my_var = "@base64_decode(\"aGVsbG8gd29ybGQ=\")"
end

base64_encode(thing)

Base64 encode an expression

Example 1: Return Base64 encoded string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "aGVsbG8gd29ybGQ=" when used with the following context:

%{"text" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = base64_encode(text)
# When used in a piece of text prefix it with an `@`
my_var = "@base64_encode(text)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "aGVsbG8gd29ybGQ=".

card MyCard do
my_var = base64_encode("hello world")
# When used in a piece of text prefix it with an `@`
my_var = "@base64_encode(\"hello world\")"
end

char(code)

Returns the character specified by a number

> "As easy as @char(65), @char(66), @char(67)"
"As easy as A, B, C"

Example 1: Return character from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "A" when used with the following context:

%{"code" => %{"__value__" => 65, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = char(code)
# When used in a piece of text prefix it with an `@`
my_var = "@char(code)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "A".

card MyCard do
my_var = char(65)
# When used in a piece of text prefix it with an `@`
my_var = "@char(65)"
end

clean(binary)

Removes all non-printable characters from a text string

Example 1: Return cleaned string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "ABC" when used with the following context:

%{"value" => %{"__value__" => <<65, 0, 66, 0, 67>>, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = clean(value)
# When used in a piece of text prefix it with an `@`
my_var = "@clean(value)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = clean(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@clean(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "ABC" when used with the following context:

%{"value" => <<65, 0, 66, 0, 67>>}
card MyCard do
my_var = clean(value)
# When used in a piece of text prefix it with an `@`
my_var = "@clean(value)"
end

code(code_ast)

Returns a numeric code for the first character in a text string

> "The numeric code of A is @CODE(\"A\")"
"The numeric code of A is 65"

Example 1: Return code from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 65 when used with the following context:

%{"value" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = code(value)
# When used in a piece of text prefix it with an `@`
my_var = "@code(value)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = code(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@code(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 65.

card MyCard do
my_var = code("A")
# When used in a piece of text prefix it with an `@`
my_var = "@code(\"A\")"
end

concatenate(argument1, argument2, argument3)

Joins text strings into one text string

> "Your name is @CONCATENATE(contact.first_name, \" \", contact.last_name)"
"Your name is name surname"

Example 1: Return concatenated string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "name surname" when used with the following context:

%{"first_name" => %{"__value__" => "name", "display" => "value for display key", "value" => "value for value key"}, "last_name" => %{"__value__" => "surname", "display" => "value for display key", "value" => "value for value key"}, "separator" => %{"__value__" => " ", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = concatenate(first_name, separator, last_name)
# When used in a piece of text prefix it with an `@`
my_var = "@concatenate(first_name, separator, last_name)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "name surname" when used with the following context:

%{"contact" => %{"first_name" => "name", "last_name" => "surname"}}
card MyCard do
my_var = concatenate(contact.first_name, " ", contact.last_name)
# When used in a piece of text prefix it with an `@`
my_var = "@concatenate(contact.first_name, \" \", contact.last_name)"
end

find_exact_match(input, keyword_set)

Find if there is an exact match to keyword set. The keywords may be numbers.

Example 1:

When used as a Journey expression it returns a value of type String: "apple".

card MyCard do
my_var = find_exact_match("apple", ["apple", "orange", "beets"])
# When used in a piece of text prefix it with an `@`
my_var = "@find_exact_match(\"apple\", [\"apple\", \"orange\", \"beets\"])"
end

find_fuzzy_matches(input, keyword_threshold_set)

Find the fuzzy matches to the keyword_threshold set. Each keyword has its own threshold.

Example 1:

When used as a Journey expression it returns a complex String type of default value:

"apple"

with the following fields:

  • match of type String
  • others of type List with values Map
  • threshold of type Integer.
card MyCard do
my_var = find_fuzzy_matches("appls", [["apple", 1], ["app", 2]])
# When used in a piece of text prefix it with an `@`
my_var = "@find_fuzzy_matches(\"appls\", [[\"apple\", 1], [\"app\", 2]])"
end

find_fuzzy_matches(input, keyword_set, threshold)

Find the fuzzy matches to the keywords using the same threshold for all keywords

Example 1:

When used as a Journey expression it returns a complex String type of default value:

"pear"

with the following fields:

  • match of type String
  • others of type **List with values **
  • threshold of type Integer.
card MyCard do
my_var = find_fuzzy_matches("pork", ["apple", "orange", "pear"], 3)
# When used in a piece of text prefix it with an `@`
my_var = "@find_fuzzy_matches(\"pork\", [\"apple\", \"orange\", \"pear\"], 3)"
end

first_word(binary)

Returns the first word in the given text - equivalent to WORD(text, 1)

Example 1: Return first word from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "foo" when used with the following context:

%{"string" => %{"__value__" => "foo bar baz", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = first_word(string)
# When used in a piece of text prefix it with an `@`
my_var = "@first_word(string)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = first_word(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@first_word(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "foo".

card MyCard do
my_var = first_word("foo bar baz")
# When used in a piece of text prefix it with an `@`
my_var = "@first_word(\"foo bar baz\")"
end

get_brief(phrase)

Extract the first few characters of the utterance, defaults to 20 characters

Example 1:

When used as a Journey expression it returns a value of type String: "this is a very lo...".

card MyCard do
my_var = get_brief("this is a very long sentence")
# When used in a piece of text prefix it with an `@`
my_var = "@get_brief(\"this is a very long sentence\")"
end

get_brief(phrase, num_chars)

Extract the first few characters of the utterance until the limit specified

Example 1:

When used as a Journey expression it returns a value of type String: "this is...".

card MyCard do
my_var = get_brief("this is a very long sentence", 10)
# When used in a piece of text prefix it with an `@`
my_var = "@get_brief(\"this is a very long sentence\", 10)"
end

has_all_words(haystack, words)

Tests whether all the words are contained in text

The words can be in any order and may appear more than once.

Example 1: Return boolean whether all the words are contained in text value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"haystack" => %{"__value__" => "the quick brown FOX", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "the fox", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_all_words(haystack, words)
# When used in a piece of text prefix it with an `@`
my_var = "@has_all_words(haystack, words)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_all_words(nil, "red fox")
# When used in a piece of text prefix it with an `@`
my_var = "@has_all_words(nil, \"red fox\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_all_words("the quick brown FOX", "red fox")
# When used in a piece of text prefix it with an `@`
my_var = "@has_all_words(\"the quick brown FOX\", \"red fox\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_all_words("the quick brown FOX", "the fox")
# When used in a piece of text prefix it with an `@`
my_var = "@has_all_words(\"the quick brown FOX\", \"the fox\")"
end

has_any_beginning(text, prefixes)

Checks if the given text starts with any of the provided prefixes. The function performs a case-insensitive match.

Example 1: Return boolean indicating if text starts with any of the provided prefixes from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"prefixes" => %{"__value__" => ["hello", "hey how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_any_beginning(text, prefixes)
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_beginning(text, prefixes)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_beginning("كيف حالك؟", ["كيف حالك", "hey how are you"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_beginning(\"كيف حالك؟\", [\"كيف حالك\", \"hey how are you\"])"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_beginning("HEY HOW ARE YOU?", ["hello", "hey how are you"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_beginning(\"HEY HOW ARE YOU?\", [\"hello\", \"hey how are you\"])"
end

has_any_end(text, end_texts)

Example 1: Return boolean indicating if text ends with any of the provided strings from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"end_texts" => %{"__value__" => ["appointment", "visit", "vaccine"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_any_end(text, end_texts)
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_end(text, end_texts)"
end

Example 2: Check whether the given text ends with any of the provided strings. The function performs a case-insensitive match.

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_end("I would like to book a vaccine", ["appointment", "visit", "vaccine"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_end(\"I would like to book a vaccine\", [\"appointment\", \"visit\", \"vaccine\"])"
end

has_any_exact_phrase(text, phrases)

Check whether the given text exactly matches any of the provided phrases. The function performs a case-insensitive exact match.

Example 1: Return boolean indicating if text exactly matches any of the provided phrases from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"phrases" => %{"__value__" => ["hello", "hey how are you?"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_any_exact_phrase(text, phrases)
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_exact_phrase(text, phrases)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_any_exact_phrase("كيف حالك؟", ["كيف حالك", "hey how are you"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_exact_phrase(\"كيف حالك؟\", [\"كيف حالك\", \"hey how are you\"])"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_exact_phrase("HEY HOW ARE YOU?", ["hello", "hey how are you?"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_exact_phrase(\"HEY HOW ARE YOU?\", [\"hello\", \"hey how are you?\"])"
end

has_any_phrase(text, phrases)

Check whether the given text contains any of the provided strings. The function performs a case-insensitive exact match. The second argument expects either a list of strings or a single string with comma-separated phrases.

Example 1: Return boolean indicating if text contains any of the provided phrases from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"phrases" => %{"__value__" => ["hello", "bye bye", "how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "hey how are you?", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_any_phrase(text, phrases)
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_phrase(text, phrases)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_phrase("hey how are you?", "hello, bye bye, how are you")
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_phrase(\"hey how are you?\", \"hello, bye bye, how are you\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_phrase("مرحباً كيف حالك؟", ["كيف حالك", "how are you"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_phrase(\"مرحباً كيف حالك؟\", [\"كيف حالك\", \"how are you\"])"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_phrase("hey how are you?", ["hello", "bye bye", "how are you"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_phrase(\"hey how are you?\", [\"hello\", \"bye bye\", \"how are you\"])"
end

has_any_word(haystack, words)

Tests whether any of the words are contained in the text

Only one of the words needs to match and it may appear more than once.

Example 1: Tests whether any of the words are contained in text value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type String when used with the following context:
%{"haystack" => %{"__value__" => "The Quick Brown Fox", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "fox quick", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_any_word(haystack, words)
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_word(haystack, words)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • match of type Null.
card MyCard do
my_var = has_any_word("The Quick Brown Fox", "yellow")
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_word(\"The Quick Brown Fox\", \"yellow\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type String.
card MyCard do
my_var = has_any_word("The Quick Brown Fox", "fox quick")
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_word(\"The Quick Brown Fox\", \"fox quick\")"
end

has_beginning(text, beginning)

Tests whether text starts with beginning

Both text values are trimmed of surrounding whitespace, but otherwise matching is strict without any tokenization.

Example 1: Tests whether text starts with beginning value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"beginning" => %{"__value__" => "the quick", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "The Quick Brown", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_beginning(text, beginning)
# When used in a piece of text prefix it with an `@`
my_var = "@has_beginning(text, beginning)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_beginning("The Quick Brown", "quick brown")
# When used in a piece of text prefix it with an `@`
my_var = "@has_beginning(\"The Quick Brown\", \"quick brown\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_beginning("The Quick Brown", "the quick")
# When used in a piece of text prefix it with an `@`
my_var = "@has_beginning(\"The Quick Brown\", \"the quick\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_beginning("The Quick Brown", "the quick")
# When used in a piece of text prefix it with an `@`
my_var = "@has_beginning(\"The Quick Brown\", \"the quick\")"
end

has_date(expression)

Tests whether expression contains a date formatted according to our environment

This is very naively implemented with a regular expression.

Example 1: Tests whether expression contains a date from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • date of type Date
  • datetime of type DateTime
  • match of type DateTime when used with the following context:
%{"expression" => %{"__value__" => "the date is 15/01/2017 05:50", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_date(expression)
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(expression)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • date of type Null
  • datetime of type Null
  • match of type Null when used with the following context:
%{"var" => 1}
card MyCard do
my_var = has_date(var)
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(var)"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • date of type Null
  • datetime of type Null
  • match of type Null.
card MyCard do
my_var = has_date(1)
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(1)"
end

Example 4:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • date of type Null
  • datetime of type Null
  • match of type Null.
card MyCard do
my_var = has_date("there is no date here, just a year 2017")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(\"there is no date here, just a year 2017\")"
end

Example 5:

When used as a Journey expression it returns a value of type DateTime: "2017-01-15T05:50:00Z".

card MyCard do
my_var = has_date("the date is 15/01/2017 05:50").datetime
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(\"the date is 15/01/2017 05:50\").datetime"
end

Example 6:

When used as a Journey expression it returns a value of type Date: "2017-01-15".

card MyCard do
my_var = has_date("the date is 15/01/2017").date
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(\"the date is 15/01/2017\").date"
end

Example 7:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • date of type Date
  • datetime of type DateTime
  • match of type DateTime.
card MyCard do
my_var = has_date("the date is 15/01/2017 05:50")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date(\"the date is 15/01/2017 05:50\")"
end

has_date_eq(expression, date_string)

Tests whether expression is a date equal to date_string

Example 1: Tests whether expression is equal to date from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Date
  • test of type Date when used with the following context:
%{"date_string" => %{"__value__" => "2017-01-15", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_date_eq("the date is 15/01/2017", "2017-01-15")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_eq(\"the date is 15/01/2017\", \"2017-01-15\")"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • error of type Map
  • match of type Null
  • test of type Date.
card MyCard do
my_var = has_date_eq("there is no date here, just a year 2017", "2017-01-15")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_eq(\"there is no date here, just a year 2017\", \"2017-01-15\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Date
  • test of type Date.
card MyCard do
my_var = has_date_eq("the date is 15/01/2017", "2017-01-15")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_eq(\"the date is 15/01/2017\", \"2017-01-15\")"
end

has_date_gt(expression, date_string)

Tests whether expression is a date after the date date_string

Example 1: Tests whether expression is greater than date from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Date
  • test of type Date when used with the following context:
%{"date_string" => %{"__value__" => "2017-01-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_date_gt(expression, date_string)
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_gt(expression, date_string)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • match of type Date
  • test of type Date.
card MyCard do
my_var = has_date_gt("the date is 15/01/2017", "2017-03-15")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_gt(\"the date is 15/01/2017\", \"2017-03-15\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Date
  • test of type Date.
card MyCard do
my_var = has_date_gt("the date is 15/01/2017", "2017-01-01")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_gt(\"the date is 15/01/2017\", \"2017-01-01\")"
end

has_date_lt(expression, date_string)

Tests whether expression contains a date before the date date_string

Example 1: Tests whether expression is less than date from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Date
  • test of type Date when used with the following context:
%{"date_string" => %{"__value__" => "2017-06-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_date_lt(expression, date_string)
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_lt(expression, date_string)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • match of type Date
  • test of type Date.
card MyCard do
my_var = has_date_lt("the date is 15/01/2021", "2017-03-15")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_lt(\"the date is 15/01/2021\", \"2017-03-15\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Date
  • test of type Date.
card MyCard do
my_var = has_date_lt("the date is 15/01/2017", "2017-06-01")
# When used in a piece of text prefix it with an `@`
my_var = "@has_date_lt(\"the date is 15/01/2017\", \"2017-06-01\")"
end

has_email(expression)

Tests whether an email is contained in text

Example 1: Tests whether an email is contained in expression from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • email of type String when used with the following context:
%{"expression" => %{"__value__" => "my email is foo1@bar.com, please respond", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_email(expression)
# When used in a piece of text prefix it with an `@`
my_var = "@has_email(expression)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • email of type Null.
card MyCard do
my_var = has_email(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@has_email(nil)"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • email of type Null.
card MyCard do
my_var = has_email("i'm not sharing my email")
# When used in a piece of text prefix it with an `@`
my_var = "@has_email(\"i'm not sharing my email\")"
end

Example 4:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • email of type String.
card MyCard do
my_var = has_email("my email is foo1@bar.com, please respond")
# When used in a piece of text prefix it with an `@`
my_var = "@has_email(\"my email is foo1@bar.com, please respond\")"
end

has_end(text, end_text)

Example 1: Return boolean indicating if text ends with provided string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"end_text" => %{"__value__" => "vaccine", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_end(text, end_text)
# When used in a piece of text prefix it with an `@`
my_var = "@has_end(text, end_text)"
end

Example 2: Check whether the given text ends with the provided string. The function performs a case-insensitive match.

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_end("I would like to book a vaccine", "vaccine")
# When used in a piece of text prefix it with an `@`
my_var = "@has_end(\"I would like to book a vaccine\", \"vaccine\")"
end

has_number(expression)

Tests whether expression contains a number

Example 1: Tests whether expression contains a number from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • number of type Float when used with the following context:
%{"string" => %{"__value__" => "the number is 42 and 5", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_number(string)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number(string)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • number of type Float.
card MyCard do
my_var = has_number("0.6")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number(\"0.6\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • number of type Float.
card MyCard do
my_var = has_number("٠.٥")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number(\"٠.٥\")"
end

Example 4:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • number of type Float.
card MyCard do
my_var = has_number("العدد ٤٢")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number(\"العدد ٤٢\")"
end

Example 5:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • number of type Float.
card MyCard do
my_var = has_number("the number is 42 and 5")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number(\"the number is 42 and 5\")"
end

has_number_eq(expression, float)

Tests whether expression contains a number equal to the value

Example 1: Tests whether expression is equal to number from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_number_eq(string, float)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(string, float)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_eq("four hundred", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"four hundred\", \"foo\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_eq("the number is 40", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 40\", \"foo\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_eq("the number is 40", "42")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 40\", \"42\")"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_eq("the number is 42.0", "42")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 42.0\", \"42\")"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_eq("the number is 0.5", "0.5")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 0.5\", \"0.5\")"
end

Example 7:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_eq("the number is 42", "42")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 42\", \"42\")"
end

Example 8:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_eq("the number is 42", 42.0)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 42\", 42.0)"
end

Example 9:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_eq("the number is 42", 42)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_eq(\"the number is 42\", 42)"
end

has_number_gt(expression, float)

Tests whether expression contains a number greater than min

Example 1: Tests whether expression is greater than number from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"float" => %{"__value__" => 40, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_number_gt(string, float)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(string, float)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gt("four hundred", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"four hundred\", \"foo\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gt("the number is 40", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 40\", \"foo\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gt("the number is 40", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 40\", \"40\")"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gt("the number is 42.0", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 42.0\", \"40\")"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gt("the number is 0.6", "0.5")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 0.6\", \"0.5\")"
end

Example 7:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gt("the number is 42", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 42\", \"40\")"
end

Example 8:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gt("the number is 42", 40.0)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 42\", 40.0)"
end

Example 9:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gt("the number is 42", 40)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gt(\"the number is 42\", 40)"
end

has_number_gte(expression, float)

Tests whether expression contains a number greater than or equal to min

Example 1: Tests whether expression is greater than or equal to number from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_number_gte(string, float)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(string, float)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gte("four hundred", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"four hundred\", \"foo\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gte("the number is 40", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 40\", \"foo\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gte("the number is 40", "45")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 40\", \"45\")"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_gte("the number is 42.0", "45")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 42.0\", \"45\")"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gte("the number is 0.5", "0.5")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 0.5\", \"0.5\")"
end

Example 7:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gte("the number is 42", "42")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 42\", \"42\")"
end

Example 8:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gte("the number is 42", 42.0)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 42\", 42.0)"
end

Example 9:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_gte("the number is 42", 42)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_gte(\"the number is 42\", 42)"
end

has_number_lt(expression, float)

Tests whether expression contains a number less than max

Example 1: Tests whether expression is less than number from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"float" => %{"__value__" => 44, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_number_lt(string, float)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(string, float)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lt("four hundred", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"four hundred\", \"foo\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lt("the number is 40", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 40\", \"foo\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lt("the number is 40", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 40\", \"40\")"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lt("the number is 42.0", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 42.0\", \"40\")"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lt("the number is 0.6", "0.5")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 0.6\", \"0.5\")"
end

Example 7:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lt("the number is 42", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 42\", \"40\")"
end

Example 8:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_lt("the number is 42", 44.0)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 42\", 44.0)"
end

Example 9:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_lt("the number is 42", 44)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lt(\"the number is 42\", 44)"
end

has_number_lte(expression, float)

Tests whether expression contains a number less than or equal to max

Example 1: Tests whether expression is less or equal than number from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_number_lte(string, float)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(string, float)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"response" => 3}
card MyCard do
my_var = has_number_lte(response, 5)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(response, 5)"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lte("four hundred", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"four hundred\", \"foo\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lte("the number is 40", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"the number is 40\", \"foo\")"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_number_lte("the number is 42.0", "40")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"the number is 42.0\", \"40\")"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_lte("the number is 0.5", "0.5")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"the number is 0.5\", \"0.5\")"
end

Example 7:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_lte("the number is 42", "42")
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"the number is 42\", \"42\")"
end

Example 8:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_lte("the number is 42", 42.0)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"the number is 42\", 42.0)"
end

Example 9:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_number_lte("the number is 42", 42)
# When used in a piece of text prefix it with an `@`
my_var = "@has_number_lte(\"the number is 42\", 42)"
end

has_only_phrase(expression, phrase)

Tests whether the text contains only phrase

The phrase must be the only text in the text to match

Example 1: Tests whether expression contains only phrase from value in value keys if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"phrase" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "Quick Brown", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_only_phrase(string, phrase)
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_phrase(string, phrase)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_only_phrase("The Quick Brown Fox", "quick brown")
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_phrase(\"The Quick Brown Fox\", \"quick brown\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_only_phrase("", "")
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_phrase(\"\", \"\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_only_phrase("Quick Brown", "quick brown")
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_phrase(\"Quick Brown\", \"quick brown\")"
end

has_only_text(expression_one, expression_two)

Returns whether two text values are equal (case sensitive). In the case that they are, it will return the text as the match.

Example 1: Returns whether two text values are equal from value in value keys if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"expression_one" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}, "expression_two" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_only_text(string, phrase)
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_text(string, phrase)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_only_text("foo", "FOO")
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_text(\"foo\", \"FOO\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_only_text("", "")
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_text(\"\", \"\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_only_text("foo", "foo")
# When used in a piece of text prefix it with an `@`
my_var = "@has_only_text(\"foo\", \"foo\")"
end

has_pattern(expression, pattern)

Tests whether expression matches the regex pattern

Both text values are trimmed of surrounding whitespace and matching is case-insensitive.

Example 1: Returns whether two text values are equal from value in value keys if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"expression" => %{"__value__" => "Buy cheese please", "display" => "value for display key", "value" => "value for value key"}, "pattern" => %{"__value__" => "buy (\\w+)", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_pattern(expression, pattern)
# When used in a piece of text prefix it with an `@`
my_var = "@has_pattern(expression, pattern)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_pattern(nil, "buy (\w+)")
# When used in a piece of text prefix it with an `@`
my_var = "@has_pattern(nil, \"buy (\w+)\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_pattern("Sell cheese please", "buy (\w+)")
# When used in a piece of text prefix it with an `@`
my_var = "@has_pattern(\"Sell cheese please\", \"buy (\w+)\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_pattern("Buy cheese please", "buy (\w+)")
# When used in a piece of text prefix it with an `@`
my_var = "@has_pattern(\"Buy cheese please\", \"buy (\w+)\")"
end

has_phone(expression)

Tests whether expresssion contains a phone number. The optional country_code argument specifies the country to use for parsing.

Example 1: Tests whether expression contains a phone number from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • phonenumber of type String when used with the following context:
%{"expression" => %{"__value__" => "my number is +12067799294 thanks", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_phone(expression)
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(expression)"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • phonenumber of type Null.
card MyCard do
my_var = has_phone("+27", "ZA")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(\"+27\", \"ZA\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • phonenumber of type Null.
card MyCard do
my_var = has_phone("+27")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(\"+27\")"
end

Example 4:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • phonenumber of type Null.
card MyCard do
my_var = has_phone(nil, "US")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(nil, \"US\")"
end

Example 5:

When used as a Journey expression it returns a complex Boolean type of default value:

false

with the following fields:

  • phonenumber of type Null.
card MyCard do
my_var = has_phone("my number is none of your business", "US")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(\"my number is none of your business\", \"US\")"
end

Example 6:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • phonenumber of type String.
card MyCard do
my_var = has_phone("my number is 206 779 9294 thanks", "US")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(\"my number is 206 779 9294 thanks\", \"US\")"
end

Example 7:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • phonenumber of type String.
card MyCard do
my_var = has_phone("my number is 2067799294 thanks", "US")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(\"my number is 2067799294 thanks\", \"US\")"
end

Example 8:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • phonenumber of type String.
card MyCard do
my_var = has_phone("my number is +12067799294 thanks")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phone(\"my number is +12067799294 thanks\")"
end

has_phone(expression, country_code)


has_phrase(expression, phrase)

Tests whether phrase is contained in expression

The words in the test phrase must appear in the same order with no other words in between.

Example 1: Tests whether expression contains phrase from value in value keys if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"expression" => %{"__value__" => "the quick brown fox", "display" => "value for display key", "value" => "value for value key"}, "phrase" => %{"__value__" => "brown fox", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_phrase(expression, phrase)
# When used in a piece of text prefix it with an `@`
my_var = "@has_phrase(expression, phrase)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_phrase("the quick brown fox", "")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phrase(\"the quick brown fox\", \"\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_phrase("the quick brown fox", "quick fox")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phrase(\"the quick brown fox\", \"quick fox\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_phrase("the quick brown fox", "brown fox")
# When used in a piece of text prefix it with an `@`
my_var = "@has_phrase(\"the quick brown fox\", \"brown fox\")"
end

has_text(expression)

Tests whether there the expression has any characters in it

Example 1: Tests whether expression has text from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"expression" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_text(expression)
# When used in a piece of text prefix it with an `@`
my_var = "@has_text(expression)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_text(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@has_text(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_text(123)
# When used in a piece of text prefix it with an `@`
my_var = "@has_text(123)"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_text("
")
# When used in a piece of text prefix it with an `@`
my_var = "@has_text(\"
\")"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_text("")
# When used in a piece of text prefix it with an `@`
my_var = "@has_text(\"\")"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_text("quick brown")
# When used in a piece of text prefix it with an `@`
my_var = "@has_text(\"quick brown\")"
end

has_time(expression)

Tests whether expression contains a time.

Example 1: Tests whether expression contains time from value in value key if complex values are provided.

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Time when used with the following context:
%{"expression" => %{"__value__" => "the time is 10:30", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_time(expression)
# When used in a piece of text prefix it with an `@`
my_var = "@has_time(expression)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = has_time("there is no time here, just the number 25")
# When used in a piece of text prefix it with an `@`
my_var = "@has_time(\"there is no time here, just the number 25\")"
end

Example 3:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Time.
card MyCard do
my_var = has_time("the time is 10:30:45")
# When used in a piece of text prefix it with an `@`
my_var = "@has_time(\"the time is 10:30:45\")"
end

Example 4:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Time.
card MyCard do
my_var = has_time("the time is 10:00 pm")
# When used in a piece of text prefix it with an `@`
my_var = "@has_time(\"the time is 10:00 pm\")"
end

Example 5:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • match of type Time.
card MyCard do
my_var = has_time("the time is 10:30")
# When used in a piece of text prefix it with an `@`
my_var = "@has_time(\"the time is 10:30\")"
end

html_to_markdown(html)

Does a best effort at converting an HTML fragment into Markdown suitable for use in a WhatsApp conversation

Example 1:

When used as a Journey expression it returns a value of type String: "*hi*" when used with the following context:

%{"html" => "<b>hi</b>"}
card MyCard do
my_var = html_to_markdown(html)
# When used in a piece of text prefix it with an `@`
my_var = "@html_to_markdown(html)"
end

left(binary, size)

Returns the first characters in a text string. This is Unicode safe.

It will return nil if the given string is nil

Example 1: Return left from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "foob" when used with the following context:

%{"size" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "foobar", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = left(value, size)
# When used in a piece of text prefix it with an `@`
my_var = "@left(value, size)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = left(nil, 4)
# When used in a piece of text prefix it with an `@`
my_var = "@left(nil, 4)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "Умерла Мадлен Олбрай".

card MyCard do
my_var = left("Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США", 20)
# When used in a piece of text prefix it with an `@`
my_var = "@left(\"Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США\", 20)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "foob".

card MyCard do
my_var = left("foobar", 4)
# When used in a piece of text prefix it with an `@`
my_var = "@left(\"foobar\", 4)"
end

len(binary)

Returns the number of characters in a text string, returns 0 if the string is null or empty

Example 1: Return length from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 3 when used with the following context:

%{"value" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = len(value)
# When used in a piece of text prefix it with an `@`
my_var = "@len(value)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 0.

card MyCard do
my_var = len(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@len(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = len("zoë")
# When used in a piece of text prefix it with an `@`
my_var = "@len(\"zoë\")"
end

Example 4:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = len("foo")
# When used in a piece of text prefix it with an `@`
my_var = "@len(\"foo\")"
end

levenshtein_distance(first_phrase, second_phrase)

Calculate the Levenshtein edit distance.

Example 1:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = levenshtein_distance("shalom", "salaam")
# When used in a piece of text prefix it with an `@`
my_var = "@levenshtein_distance(\"shalom\", \"salaam\")"
end

lower(binary)

Converts a text string to lowercase

Example 1: Return lowercased string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "foo bar" when used with the following context:

%{"value" => %{"__value__" => "Foo Bar", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = lower(value)
# When used in a piece of text prefix it with an `@`
my_var = "@lower(value)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = lower(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@lower(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "foo bar".

card MyCard do
my_var = lower("Foo Bar")
# When used in a piece of text prefix it with an `@`
my_var = "@lower(\"Foo Bar\")"
end

mid(text, start_num, num_chars)

MID extracts part of a string, starting at a specified position and for a specified length.

It correctly handles Unicode characters. For example, taking the first three characters from "héllo" returns "hél".

If the starting position is beyond the string length, it returns an empty string.

Implementation based on https://support.microsoft.com/en-us/office/mid-function-2eba57be-0c05-4bdc-bf81-5ecf4421eb8a

Example 1: Extract from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "Flow" when used with the following context:

%{"num_chars" => %{"__value__" => 5, "display" => "value for display key", "value" => "value for value key"}, "start_num" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "Fluid Flow", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = mid(value, 7, 20)
# When used in a piece of text prefix it with an `@`
my_var = "@mid(value, 7, 20)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = MID("Fluid Flow", 20, 5)
# When used in a piece of text prefix it with an `@`
my_var = "@MID(\"Fluid Flow\", 20, 5)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "Flow".

card MyCard do
my_var = MID("Fluid Flow", 7, 20)
# When used in a piece of text prefix it with an `@`
my_var = "@MID(\"Fluid Flow\", 7, 20)"
end

Example 4: MID returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.

When used as a Journey expression it returns a value of type String: "Fluid".

card MyCard do
my_var = MID("Fluid", 1, 5)
# When used in a piece of text prefix it with an `@`
my_var = "@MID(\"Fluid\", 1, 5)"
end

normalise_text(phrase)

Normalize text using Unicode NFKC (Normalisation Form Compatibility Composition) normalisation.

Accepts unicode multibyte characters and attempts to normalise them.

Example 1:

When used as a Journey expression it returns a value of type String: "abcABC" when used with the following context:

%{"phrase" => "abcABC"}
card MyCard do
my_var = normalise_text(phrase)
# When used in a piece of text prefix it with an `@`
my_var = "@normalise_text(phrase)"
end

normalise_whitespace(phrase)

Normalise whitespace by replacing spans of whitespace with a single space

Example 1:

When used as a Journey expression it returns a value of type String: "hello world".

card MyCard do
my_var = normalise_whitespace("hello world")
# When used in a piece of text prefix it with an `@`
my_var = "@normalise_whitespace(\"hello world\")"
end

proper(binary)

Capitalizes the first letter of every word in a text string

Example 1: Return first letter of every word capitalized string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "Foo Bar" when used with the following context:

%{"value" => %{"__value__" => "foo bar", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = proper(value)
# When used in a piece of text prefix it with an `@`
my_var = "@proper(value)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = proper(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@proper(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "Foo Bar".

card MyCard do
my_var = proper("foo bar")
# When used in a piece of text prefix it with an `@`
my_var = "@proper(\"foo bar\")"
end

read_digits(binary)

Formats digits in text for reading in TTS

Example 1: Return read digits from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "plus two seven one" when used with the following context:

%{"digits" => %{"__value__" => "+271", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = read_digits(digits)
# When used in a piece of text prefix it with an `@`
my_var = "@read_digits(digits)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = read_digits(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@read_digits(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "plus two seven one".

card MyCard do
my_var = read_digits("+271")
# When used in a piece of text prefix it with an `@`
my_var = "@read_digits(\"+271\")"
end

regex_capture(binary, pattern)

Capture values out of a string using a regex. Returns the list of captures in a list. Returns nil if there was nothing to match

Example 1: Return captures from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String:

[
"ing"
]

when used with the following context:

%{"pattern" => %{"__value__" => "test(.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = regex_capture(string, pattern)
# When used in a piece of text prefix it with an `@`
my_var = "@regex_capture(string, pattern)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = regex_capture("testing", "foo(.+)")
# When used in a piece of text prefix it with an `@`
my_var = "@regex_capture(\"testing\", \"foo(.+)\")"
end

Example 3:

When used as a Journey expression it returns a value of type List with values String:

[
"ing"
]
card MyCard do
my_var = regex_capture("testing", "test(.+)")
# When used in a piece of text prefix it with an `@`
my_var = "@regex_capture(\"testing\", \"test(.+)\")"
end

regex_named_capture(binary, pattern)

Captures named values out of a string using a regex. In contrast to regex_capture() this returns a map where the keys are the names of the captures and the values are the captured values.

Example 1: Return captures from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Map:

{
"match": "ing"
}

when used with the following context:

%{"pattern" => %{"__value__" => "test(?P<match>.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = regex_named_capture(string, pattern)
# When used in a piece of text prefix it with an `@`
my_var = "@regex_named_capture(string, pattern)"
end

Example 2:

When used as a Journey expression it returns a value of type Map: {}.

card MyCard do
my_var = regex_named_capture("testing", "foo(?P<match>.+)")
# When used in a piece of text prefix it with an `@`
my_var = "@regex_named_capture(\"testing\", \"foo(?P<match>.+)\")"
end

Example 3:

When used as a Journey expression it returns a value of type Map:

{
"match": "ing"
}
card MyCard do
my_var = regex_named_capture("testing", "test(?P<match>.+)")
# When used in a piece of text prefix it with an `@`
my_var = "@regex_named_capture(\"testing\", \"test(?P<match>.+)\")"
end

remove_emojis(phrase)

Remove emojis from a string. Replaces it with a symbol rather than remove it completely for the following emojis: 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ #️⃣ *️⃣ ©️ ®️

Example 1:

When used as a Journey expression it returns a value of type String: "1.123".

card MyCard do
my_var = remove_emojis("1.123")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_emojis(\"1.123\")"
end

Example 2:

When used as a Journey expression it returns a value of type String: "1".

card MyCard do
my_var = remove_emojis("1")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_emojis(\"1\")"
end

Example 3:

When used as a Journey expression it returns a value of type String: "1 2 3 Turn loves you ".

card MyCard do
my_var = remove_emojis("1️⃣ 2️⃣ 3️⃣ Turn loves you ❤️")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_emojis(\"1️⃣ 2️⃣ 3️⃣ Turn loves you ❤️\")"
end

remove_first_word(binary)

Removes the first word from the given text. The remaining text will be unchanged

Example 1: Return string with first word removed from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "bar" when used with the following context:

%{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = remove_first_word(string, seperator)
# When used in a piece of text prefix it with an `@`
my_var = "@remove_first_word(string, seperator)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = remove_first_word(nil, "-")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_first_word(nil, \"-\")"
end

Example 3:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = remove_first_word(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@remove_first_word(nil)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "bar".

card MyCard do
my_var = remove_first_word("foo-bar", "-")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_first_word(\"foo-bar\", \"-\")"
end

Example 5:

When used as a Journey expression it returns a value of type String: "bar".

card MyCard do
my_var = remove_first_word("foo bar")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_first_word(\"foo bar\")"
end

remove_first_word(binary, separator)


remove_last_word(binary)

Example 1: Return string with last word removed from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "foo" when used with the following context:

%{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = remove_last_word(string, seperator)
# When used in a piece of text prefix it with an `@`
my_var = "@remove_last_word(string, seperator)"
end

Example 2: Remove the last word from a list of words, using spaces as separator between words

When used as a Journey expression it returns a value of type String: "foo".

card MyCard do
my_var = remove_last_word("foo bar")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_last_word(\"foo bar\")"
end

Example 3: Remove the last word from a list of words, using the specified separator

When used as a Journey expression it returns a value of type String: "foo".

card MyCard do
my_var = remove_last_word("foo-bar", "-")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_last_word(\"foo-bar\", \"-\")"
end

remove_last_word(binary, separator)


remove_numbers(phrase)

Remove numbers

Example 1:

When used as a Journey expression it returns a value of type String: "counting down ".

card MyCard do
my_var = remove_numbers("counting down 3 2 1")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_numbers(\"counting down 3 2 1\")"
end

remove_punc(phrase)

Remove punctuation without substitution

Example 1:

When used as a Journey expression it returns a value of type String: "hello world".

card MyCard do
my_var = remove_punc("hello? world!")
# When used in a piece of text prefix it with an `@`
my_var = "@remove_punc(\"hello? world!\")"
end

replace_punc(phrase)

Replace punctuation marks with spaces

Example 1:

When used as a Journey expression it returns a value of type String: "hello world ".

card MyCard do
my_var = replace_punc("hello? world!")
# When used in a piece of text prefix it with an `@`
my_var = "@replace_punc(\"hello? world!\")"
end

rept(value, amount)

Repeats text a given number of times

Example 1: Return repeated string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "**********" when used with the following context:

%{"amount" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "*", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = rept(value, amount)
# When used in a piece of text prefix it with an `@`
my_var = "@rept(value, amount)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = rept(nil, 10)
# When used in a piece of text prefix it with an `@`
my_var = "@rept(nil, 10)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "**********".

card MyCard do
my_var = rept("*", 10)
# When used in a piece of text prefix it with an `@`
my_var = "@rept(\"*\", 10)"
end

right(binary, size)

Returns the last characters in a text string. This is Unicode safe.

Example 1: Return right from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "ing" when used with the following context:

%{"size" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = right(string, size)
# When used in a piece of text prefix it with an `@`
my_var = "@right(string, size)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = right(nil, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@right(nil, 3)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "ту главы Госдепа США".

card MyCard do
my_var = right("Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США", 20)
# When used in a piece of text prefix it with an `@`
my_var = "@right(\"Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США\", 20)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "ing".

card MyCard do
my_var = right("testing", 3)
# When used in a piece of text prefix it with an `@`
my_var = "@right(\"testing\", 3)"
end

split(binary)

Split a string into an array using the pattern as separator. Defaults to split the string using a space.

Example 1: Split from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"t",
"sting som",
"thing"
]

when used with the following context:

%{"pattern" => %{"__value__" => "e", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = split(string, pattern)
# When used in a piece of text prefix it with an `@`
my_var = "@split(string, pattern)"
end

Example 2: Split from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String:

[
"testing",
"something"
]

when used with the following context:

%{"string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = split(string)
# When used in a piece of text prefix it with an `@`
my_var = "@split(string)"
end

Example 3:

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"t",
"sting som",
"thing"
]
card MyCard do
my_var = split("testing something", "e")
# When used in a piece of text prefix it with an `@`
my_var = "@split(\"testing something\", \"e\")"
end

Example 4:

When used as a Journey expression it returns a value of type List with values String, String:

[
"testing",
"something"
]
card MyCard do
my_var = split("testing something")
# When used in a piece of text prefix it with an `@`
my_var = "@split(\"testing something\")"
end

split(binary, pattern)


substitute(subject, pattern, replacement)

Substitutes new_text for old_text in a text string. If instance_num is given, then only that instance will be substituted

Example 1: Return substituted string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "I can do" when used with the following context:

%{"pattern" => %{"__value__" => "can't", "display" => "value for display key", "value" => "value for value key"}, "replacement" => %{"__value__" => "can do", "display" => "value for display key", "value" => "value for value key"}, "subject" => %{"__value__" => "I can't", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = substitute(subject, pattern, replacement)
# When used in a piece of text prefix it with an `@`
my_var = "@substitute(subject, pattern, replacement)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = substitute(nil, "can't", "can do")
# When used in a piece of text prefix it with an `@`
my_var = "@substitute(nil, \"can't\", \"can do\")"
end

Example 3:

When used as a Journey expression it returns a value of type String: "I can do".

card MyCard do
my_var = substitute("I can't", "can't", "can do")
# When used in a piece of text prefix it with an `@`
my_var = "@substitute(\"I can't\", \"can't\", \"can do\")"
end

text(value)

Converts a value to a string.

Numbers, booleans, dates, and other values are converted to their string representation. Nil becomes an empty string.

Example 1: Convert from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "42" when used with the following context:

%{"value" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = text(value)
# When used in a piece of text prefix it with an `@`
my_var = "@text(value)"
end

Example 2: A string is returned as-is

When used as a Journey expression it returns a value of type String: "hello".

card MyCard do
my_var = text("hello")
# When used in a piece of text prefix it with an `@`
my_var = "@text(\"hello\")"
end

Example 3: Convert nil to an empty string

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = text(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@text(nil)"
end

Example 4: Convert a boolean to a string

When used as a Journey expression it returns a value of type String: "true".

card MyCard do
my_var = text(true)
# When used in a piece of text prefix it with an `@`
my_var = "@text(true)"
end

Example 5: Convert a float to a string

When used as a Journey expression it returns a value of type String: "3.14".

card MyCard do
my_var = text(3.14)
# When used in a piece of text prefix it with an `@`
my_var = "@text(3.14)"
end

Example 6: Convert an integer to a string

When used as a Journey expression it returns a value of type String: "5".

card MyCard do
my_var = text(5)
# When used in a piece of text prefix it with an `@`
my_var = "@text(5)"
end

unichar(code)

Returns the unicode character specified by a number

Example 1: Return unicode character from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "é" when used with the following context:

%{"code" => %{"__value__" => 233, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = unichar(code)
# When used in a piece of text prefix it with an `@`
my_var = "@unichar(code)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "é".

card MyCard do
my_var = unichar(233)
# When used in a piece of text prefix it with an `@`
my_var = "@unichar(233)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "A".

card MyCard do
my_var = unichar(65)
# When used in a piece of text prefix it with an `@`
my_var = "@unichar(65)"
end

unicode(letter)

Returns a numeric code for the first character in a text string

Example 1: Return unicode code from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 233 when used with the following context:

%{"char" => %{"__value__" => "é", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = unicode(char)
# When used in a piece of text prefix it with an `@`
my_var = "@unicode(char)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 233.

card MyCard do
my_var = unicode("é")
# When used in a piece of text prefix it with an `@`
my_var = "@unicode(\"é\")"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 65.

card MyCard do
my_var = unicode("A")
# When used in a piece of text prefix it with an `@`
my_var = "@unicode(\"A\")"
end

upper(binary)

Converts a text string to uppercase

Example 1: Return uppercased string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "FOO" when used with the following context:

%{"string" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = upper(string)
# When used in a piece of text prefix it with an `@`
my_var = "@upper(string)"
end

Example 2:

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = upper(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@upper(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "FOO".

card MyCard do
my_var = upper("foo")
# When used in a piece of text prefix it with an `@`
my_var = "@upper(\"foo\")"
end

url_decode(thing)

URL decode an expression

Example 1: Return URL decoded string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "hello world" when used with the following context:

%{"url" => %{"__value__" => "hello%20world", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = url_decode(url)
# When used in a piece of text prefix it with an `@`
my_var = "@url_decode(url)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "hello world".

card MyCard do
my_var = url_decode("hello%20world")
# When used in a piece of text prefix it with an `@`
my_var = "@url_decode(\"hello%20world\")"
end

url_encode(thing)

URL encode an expression

Example 1: URL encode an integer from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "1" when used with the following context:

%{"number" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = url_encode(number)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(number)"
end

Example 2: Return URL encoded string from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "hello%20world" when used with the following context:

%{"url" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = url_encode(url)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(url)"
end

Example 3: URL encode a date by first converting it to a string.

When used as a Journey expression it returns a value of type String: "2024-01-15" when used with the following context:

%{"date" => ~D[2024-01-15]}
card MyCard do
my_var = url_encode(date)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(date)"
end

Example 4: URL encode nil returns an empty string.

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = url_encode(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(nil)"
end

Example 5: URL encode a boolean by first converting it to a string.

When used as a Journey expression it returns a value of type String: "true".

card MyCard do
my_var = url_encode(true)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(true)"
end

Example 6: URL encode a float by first converting it to a string.

When used as a Journey expression it returns a value of type String: "3.14".

card MyCard do
my_var = url_encode(3.14)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(3.14)"
end

Example 7: URL encode an integer by first converting it to a string.

When used as a Journey expression it returns a value of type String: "42".

card MyCard do
my_var = url_encode(42)
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(42)"
end

Example 8:

When used as a Journey expression it returns a value of type String: "hello%20world".

card MyCard do
my_var = url_encode("hello world")
# When used in a piece of text prefix it with an `@`
my_var = "@url_encode(\"hello world\")"
end

word(binary, n)

Extracts the nth word from the given text string. If stop is a negative number, then it is treated as count backwards from the end of the text. If by_spaces is specified and is true then the function splits the text into words only by spaces. Otherwise the text is split by punctuation characters as well

Example 1: Return nth word from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "cow" when used with the following context:

%{"n" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = word(string, n)
# When used in a piece of text prefix it with an `@`
my_var = "@word(string, n)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = word(nil, 1)
# When used in a piece of text prefix it with an `@`
my_var = "@word(nil, 1)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "boy".

card MyCard do
my_var = word("hello cow-boy", -1)
# When used in a piece of text prefix it with an `@`
my_var = "@word(\"hello cow-boy\", -1)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "cow-boy".

card MyCard do
my_var = word("hello cow-boy", 2, true)
# When used in a piece of text prefix it with an `@`
my_var = "@word(\"hello cow-boy\", 2, true)"
end

Example 5:

When used as a Journey expression it returns a value of type String: "cow".

card MyCard do
my_var = word("hello cow-boy", 2)
# When used in a piece of text prefix it with an `@`
my_var = "@word(\"hello cow-boy\", 2)"
end

word(binary, n, by_spaces)


word_count(binary)

Returns the number of words in the given text string. If by_spaces is specified and is true then the function splits the text into words only by spaces. Otherwise the text is split by punctuation characters as well

> You entered @word_count("one two three") words
You entered 3 words

Example 1: Return word count from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 2 when used with the following context:

%{"by_spaces" => %{"__value__" => true, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = word_count(string, by_spaces)
# When used in a piece of text prefix it with an `@`
my_var = "@word_count(string, by_spaces)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 0.

card MyCard do
my_var = word_count(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@word_count(nil)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 2.

card MyCard do
my_var = word_count("hello cow-boy", true)
# When used in a piece of text prefix it with an `@`
my_var = "@word_count(\"hello cow-boy\", true)"
end

Example 4:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = word_count("hello cow-boy")
# When used in a piece of text prefix it with an `@`
my_var = "@word_count(\"hello cow-boy\")"
end

word_count(binary, by_spaces)


word_slice(binary, start)

Extracts a substring of the words beginning at start, and up to but not-including stop. If stop is omitted then the substring will be all words from start until the end of the text. If stop is a negative number, then it is treated as count backwards from the end of the text. If by_spaces is specified and is true then the function splits the text into words only by spaces. Otherwise the text is split by punctuation characters as well

Example 1: Return word slice from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "expressions are" when used with the following context:

%{"start" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "stop" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "FLOIP expressions are fun", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = word_slice(string, start, stop)
# When used in a piece of text prefix it with an `@`
my_var = "@word_slice(string, start, stop)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "".

card MyCard do
my_var = word_slice(nil, -1)
# When used in a piece of text prefix it with an `@`
my_var = "@word_slice(nil, -1)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "fun".

card MyCard do
my_var = word_slice("FLOIP expressions are fun", -1)
# When used in a piece of text prefix it with an `@`
my_var = "@word_slice(\"FLOIP expressions are fun\", -1)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "FLOIP expressions".

card MyCard do
my_var = word_slice("FLOIP expressions are fun", 1, -2)
# When used in a piece of text prefix it with an `@`
my_var = "@word_slice(\"FLOIP expressions are fun\", 1, -2)"
end

Example 5:

When used as a Journey expression it returns a value of type String: "expressions are fun".

card MyCard do
my_var = word_slice("FLOIP expressions are fun", 2)
# When used in a piece of text prefix it with an `@`
my_var = "@word_slice(\"FLOIP expressions are fun\", 2)"
end

Example 6:

When used as a Journey expression it returns a value of type String: "expressions are".

card MyCard do
my_var = word_slice("FLOIP expressions are fun", 2, 4)
# When used in a piece of text prefix it with an `@`
my_var = "@word_slice(\"FLOIP expressions are fun\", 2, 4)"
end

word_slice(binary, start, stop)


word_slice(binary, start, stop, by_spaces)


Number

abs(number)

Returns the absolute value of a number

Example 1:

When used as a Journey expression it returns a value of type Float: 0.5 when used with the following context:

%{"number" => %{"__value__" => -0.5, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = abs(number)
# When used in a piece of text prefix it with an `@`
my_var = "@abs(number)"
end

Example 2:

When used as a Journey expression it returns a value of type Float: 0.5.

card MyCard do
my_var = abs(-0.5)
# When used in a piece of text prefix it with an `@`
my_var = "@abs(-0.5)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 1.

card MyCard do
my_var = abs(-1)
# When used in a piece of text prefix it with an `@`
my_var = "@abs(-1)"
end

fixed(number, precision)

Formats the given number in decimal format using a period and commas

> You have @fixed(contact.balance, 2) in your account
"You have 4.21 in your account"

Example 1: Format from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "4.21" when used with the following context:

%{"no_commas" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "number" => %{"__value__" => 4.209922, "display" => "value for display key", "value" => "value for value key"}, "precision" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = fixed(number, precision, no_commas)
# When used in a piece of text prefix it with an `@`
my_var = "@fixed(number, precision, no_commas)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "0.09".

card MyCard do
my_var = fixed(0.0909, 2)
# When used in a piece of text prefix it with an `@`
my_var = "@fixed(0.0909, 2)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "3.80".

card MyCard do
my_var = fixed(3.7979, 2)
# When used in a piece of text prefix it with an `@`
my_var = "@fixed(3.7979, 2)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "3.80".

card MyCard do
my_var = fixed(3.7979, 2, false)
# When used in a piece of text prefix it with an `@`
my_var = "@fixed(3.7979, 2, false)"
end

Example 5:

When used as a Journey expression it returns a value of type String: "4000.4242".

card MyCard do
my_var = fixed(4000.424242, 4, true)
# When used in a piece of text prefix it with an `@`
my_var = "@fixed(4000.424242, 4, true)"
end

Example 6:

When used as a Journey expression it returns a value of type String: "4.21".

card MyCard do
my_var = fixed(4.209922, 2, false)
# When used in a piece of text prefix it with an `@`
my_var = "@fixed(4.209922, 2, false)"
end

fixed(number, precision, no_commas)


int(value)

Converts a value to an integer.

Strings are parsed as integers, floats are truncated, booleans become 1 or 0, and nil becomes 0.

Returns an error map if the value cannot be converted.

Example 1: Convert from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 42 when used with the following context:

%{"value" => %{"__value__" => "42", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = int(value)
# When used in a piece of text prefix it with an `@`
my_var = "@int(value)"
end

Example 2: Return an error for non-numeric strings

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = int("abc")
# When used in a piece of text prefix it with an `@`
my_var = "@int(\"abc\")"
end

Example 3: Convert nil to 0

When used as a Journey expression it returns a value of type Integer: 0.

card MyCard do
my_var = int(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@int(nil)"
end

Example 4: Convert false to 0

When used as a Journey expression it returns a value of type Integer: 0.

card MyCard do
my_var = int(false)
# When used in a piece of text prefix it with an `@`
my_var = "@int(false)"
end

Example 5: Convert a boolean to an integer

When used as a Journey expression it returns a value of type Integer: 1.

card MyCard do
my_var = int(true)
# When used in a piece of text prefix it with an `@`
my_var = "@int(true)"
end

Example 6: Truncate a float to an integer

When used as a Journey expression it returns a value of type Integer: 5.

card MyCard do
my_var = int(5.7)
# When used in a piece of text prefix it with an `@`
my_var = "@int(5.7)"
end

Example 7: Convert a string to an integer

When used as a Journey expression it returns a value of type Integer: 5.

card MyCard do
my_var = int("5")
# When used in a piece of text prefix it with an `@`
my_var = "@int(\"5\")"
end

max(argument1, argument2, argument3)

Returns the maximum value of all arguments

Example 1:

When used as a Journey expression it returns a value of type Integer: 4 when used with the following context:

%{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = max(value1, value2, value3)
# When used in a piece of text prefix it with an `@`
my_var = "@max(value1, value2, value3)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = max(1, 2, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@max(1, 2, 3)"
end

min(argument1, argument2, argument3)

Returns the minimum value of all arguments

Example 1:

When used as a Journey expression it returns a value of type Integer: 1 when used with the following context:

%{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = min(value1, value2, value3)
# When used in a piece of text prefix it with an `@`
my_var = "@min(value1, value2, value3)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 1.

card MyCard do
my_var = min(1, 2, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@min(1, 2, 3)"
end

number(value)

Converts a value to a floating-point number.

Strings are parsed as floats, integers are promoted, booleans become 1.0 or 0.0, and nil becomes 0.0.

Returns an error map if the value cannot be converted.

Example 1: Convert from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Float: 3.14 when used with the following context:

%{"value" => %{"__value__" => "3.14", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = number(value)
# When used in a piece of text prefix it with an `@`
my_var = "@number(value)"
end

Example 2: Return an error for non-numeric strings

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = number("abc")
# When used in a piece of text prefix it with an `@`
my_var = "@number(\"abc\")"
end

Example 3: Convert nil to a number

When used as a Journey expression it returns a value of type Integer: 0.

card MyCard do
my_var = number(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@number(nil)"
end

Example 4: Convert a boolean to a float

When used as a Journey expression it returns a value of type Float: 1.0.

card MyCard do
my_var = number(true)
# When used in a piece of text prefix it with an `@`
my_var = "@number(true)"
end

Example 5: Convert an integer to a float

When used as a Journey expression it returns a value of type Float: 5.0.

card MyCard do
my_var = number(5)
# When used in a piece of text prefix it with an `@`
my_var = "@number(5)"
end

Example 6: Convert an integer string to a float

When used as a Journey expression it returns a value of type Float: 5.0.

card MyCard do
my_var = number("5")
# When used in a piece of text prefix it with an `@`
my_var = "@number(\"5\")"
end

Example 7: Convert a string to a float

When used as a Journey expression it returns a value of type Float: 5.5.

card MyCard do
my_var = number("5.5")
# When used in a piece of text prefix it with an `@`
my_var = "@number(\"5.5\")"
end

parse_float(number)


parse_float(binary)


percent(float)

Formats a number as a percentage

Example 1: Return percentage from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "20%" when used with the following context:

%{"number" => %{"__value__" => 0.2, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = percent(number)
# When used in a piece of text prefix it with an `@`
my_var = "@percent(number)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "20%" when used with the following context:

%{"d" => "0.2"}
card MyCard do
my_var = percent(d)
# When used in a piece of text prefix it with an `@`
my_var = "@percent(d)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "20%".

card MyCard do
my_var = percent(0.2)
# When used in a piece of text prefix it with an `@`
my_var = "@percent(0.2)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "20%".

card MyCard do
my_var = percent(2/10)
# When used in a piece of text prefix it with an `@`
my_var = "@percent(2/10)"
end

power(a, b)

Returns the result of a number raised to a power - equivalent to the ^ operator

Example 1:

When used as a Journey expression it returns a value of type Float: 8.0 when used with the following context:

%{"number" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "power" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = power(number, power)
# When used in a piece of text prefix it with an `@`
my_var = "@power(number, power)"
end

Example 2:

When used as a Journey expression it returns a value of type Float: 8.0.

card MyCard do
my_var = power(2, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@power(2, 3)"
end

rand_between(min, max)

Generate a random number between min and max

Example 1: Generate a number between min and max from value in value keys if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 2 when used with the following context:

%{"max" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "min" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = rand_between(min, max)
# When used in a piece of text prefix it with an `@`
my_var = "@rand_between(min, max)"
end

Example 2: Generate a number between 1 and 10

When used as a Journey expression it returns a value of type Integer: 5.

card MyCard do
my_var = rand_between(1, 10)
# When used in a piece of text prefix it with an `@`
my_var = "@rand_between(1, 10)"
end

rem(integer1, integer2)

Return the division remainder of two integers.

Example 1: Return the division remainder of two integers from value in value keys if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 0 when used with the following context:

%{"int1" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "int2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = rem(int1, int2)
# When used in a piece of text prefix it with an `@`
my_var = "@rem(int1, int2)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 1.

card MyCard do
my_var = rem(85, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@rem(85, 3)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 0.

card MyCard do
my_var = rem(4, 2)
# When used in a piece of text prefix it with an `@`
my_var = "@rem(4, 2)"
end

round(value)

Example 1: Rounds from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type String: "23.78" when used with the following context:

%{"digits" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => 23.7825, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = round(value, digits)
# When used in a piece of text prefix it with an `@`
my_var = "@round(value, digits)"
end

Example 2: The ROUND function rounds a number to a specified number of digits. For example, if cell A1 contains 23.7825, and you want to round that value to zero decimal places you can do ROUND(23.7825)

When used as a Journey expression it returns a value of type String: "24".

card MyCard do
my_var = ROUND(23.7825)
# When used in a piece of text prefix it with an `@`
my_var = "@ROUND(23.7825)"
end

Example 3: The ROUND function rounds a number to a specified number of digits. For example, if cell A1 contains 23.7825, and you want to round that value to two decimal places you can do ROUND(23.7825, 2)

When used as a Journey expression it returns a value of type String: "23.78".

card MyCard do
my_var = ROUND(23.7825, 2)
# When used in a piece of text prefix it with an `@`
my_var = "@ROUND(23.7825, 2)"
end

round(value, places)


sum(argument1, argument2, argument3)

Returns the sum of all arguments, equivalent to the + operator

You have @SUM(contact.reports, contact.forms) reports and forms

Example 1: Sum from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 6 when used with the following context:

%{"val1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = sum(val1, val2, val3)
# When used in a piece of text prefix it with an `@`
my_var = "@sum(val1, val2, val3)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 6.

card MyCard do
my_var = sum(1, 2, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@sum(1, 2, 3)"
end

Date

date(year, month, day)

Defines a new date value

Example 1: Construct date from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Date: "2025-01-15" when used with the following context:

%{"day" => %{"__value__" => 15, "display" => "value for display key", "value" => "value for value key"}, "month" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "year" => %{"__value__" => 2025, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = date(year, month, day)
# When used in a piece of text prefix it with an `@`
my_var = "@date(year, month, day)"
end

Example 2: Invalid date inputs

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String when used with the following context:
%{}
card MyCard do
my_var = date(nil, nil, nil)
# When used in a piece of text prefix it with an `@`
my_var = "@date(nil, nil, nil)"
end

Example 3: Construct a date from year, month, and day integers

When used as a Journey expression it returns a value of type Date: "2022-01-31" when used with the following context:

%{"day" => 31, "month" => 1, "year" => 2022}
card MyCard do
my_var = date(year, month, day)
# When used in a piece of text prefix it with an `@`
my_var = "@date(year, month, day)"
end

datetime_add(datetime, offset, unit)

Calculates a new datetime based on the offset and unit provided.

The unit can be any of the following values:

  • "Y" for years
  • "M" for months
  • "W" for weeks
  • "D" for days
  • "h" for hours
  • "m" for minutes
  • "s" for seconds

Specifying a negative offset results in date calculations back in time.

Example 1: Calculates date from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type DateTime: "2022-08-31T00:00:00Z" when used with the following context:

%{"datetime" => %{"__value__" => ~U[2022-07-31 00:00:00Z], "display" => "value for display key", "value" => "value for value key"}, "offset" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "unit" => %{"__value__" => "M", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = datetime_add(datetime, offset, unit)
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_add(datetime, offset, unit)"
end

Example 2: Invalid date inputs

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String when used with the following context:
%{}
card MyCard do
my_var = datetime_add("_..[0]._", 0, "h")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_add(\"_..[0]._\", 0, \"h\")"
end

Example 3: Negative offsets

When used as a Journey expression it returns a value of type DateTime: "2020-02-28T00:00:00.000000Z".

card MyCard do
my_var = datetime_add(date(2020, 02, 29), -1, "D")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_add(date(2020, 02, 29), -1, \"D\")"
end

Example 4: Leap year handling outside of a leap year.

When used as a Journey expression it returns a value of type DateTime: "2021-03-01T00:00:00.000000Z".

card MyCard do
my_var = datetime_add(date(2021, 02, 28), 1, "D")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_add(date(2021, 02, 28), 1, \"D\")"
end

Example 5: Leap year handling in a leap year.

When used as a Journey expression it returns a value of type DateTime: "2020-02-29T00:00:00.000000Z".

card MyCard do
my_var = datetime_add(date(2020, 02, 28), 1, "D")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_add(date(2020, 02, 28), 1, \"D\")"
end

Example 6: Calculates a new datetime based on the offset and unit provided.

When used as a Journey expression it returns a value of type DateTime: "2022-08-31T00:00:00Z" when used with the following context:

%{"datetime" => ~U[2022-07-31 00:00:00Z], "offset" => 1, "unit" => "M"}
card MyCard do
my_var = datetime_add(datetime, offset, unit)
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_add(datetime, offset, unit)"
end

datetime_from_unix(unix, unit)

Parses a UNIX time and returns a DateTime

Example 1: Parses date from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type DateTime: "2023-12-06T23:00:00.000Z" when used with the following context:

%{"unit" => %{"__value__" => "millisecond", "display" => "value for display key", "value" => "value for value key"}, "unix_time" => %{"__value__" => "1701903600000", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = datetime_from_unix(unix_time, unit)
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_from_unix(unix_time, unit)"
end

Example 2:

When used as a Journey expression it returns a value of type DateTime: "2023-12-06T23:00:00Z" when used with the following context:

%{}
card MyCard do
my_var = datetime_from_unix("1701903600", "second")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_from_unix(\"1701903600\", \"second\")"
end

Example 3:

When used as a Journey expression it returns a value of type DateTime: "2023-12-06T23:00:00.000Z" when used with the following context:

%{}
card MyCard do
my_var = datetime_from_unix(1701903600000, "millisecond")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_from_unix(1701903600000, \"millisecond\")"
end

Example 4:

When used as a Journey expression it returns a value of type DateTime: "2023-12-06T23:00:00.000Z" when used with the following context:

%{}
card MyCard do
my_var = datetime_from_unix("1701903600000", "millisecond")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_from_unix(\"1701903600000\", \"millisecond\")"
end

datetime_next(desired_day, time, base_date)

Calculates a new datetime based on a base date, a desired day and a desired time.

Example 1: Shifts a datetime to the next occurrence of a given day of the week and a set time.

When used as a Journey expression it returns a value of type DateTime: "2023-02-06T10:00:00-03:00" when used with the following context:

%{"base_date" => ~U[2023-02-03 20:18:03Z], "contact" => %{"whatsapp_id" => "552197295926"}}
card MyCard do
my_var = datetime_next("monday", "10:00", base_date)
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_next(\"monday\", \"10:00\", base_date)"
end

Example 2: If the day of the week is the same as the base date and after the target time, the next occurrence is 7 days later.

When used as a Journey expression it returns a value of type DateTime: "2023-02-09T10:30:00-03:00" when used with the following context:

%{"base_date" => ~U[2023-02-02 20:18:03Z], "contact" => %{"whatsapp_id" => "552197295926"}}
card MyCard do
my_var = datetime_next("thursday", "10:30", base_date)
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_next(\"thursday\", \"10:30\", base_date)"
end

Example 3: If the day of the week is the same as the base date, but still before the target time, it returns the same day rather than shifting a full week.

When used as a Journey expression it returns a value of type DateTime: "2023-02-02T10:30:00-03:00" when used with the following context:

%{"base_date" => ~U[2023-02-02 08:08:08Z], "contact" => %{"whatsapp_id" => "552197295926"}}
card MyCard do
my_var = datetime_next("thursday", "10:30", base_date)
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_next(\"thursday\", \"10:30\", base_date)"
end

datetime_next(desired_day, time)

Calculates a new datetime based on today's date and time, a desired day and a desired time.

Example 1:

When used as a Journey expression it returns a value of type DateTime: "2026-08-22T13:45:00-03:00" when used with the following context:

%{"contact" => %{"whatsapp_id" => "552197295926"}}
card MyCard do
my_var = datetime_next("saturday", "13:45")
# When used in a piece of text prefix it with an `@`
my_var = "@datetime_next(\"saturday\", \"13:45\")"
end

datevalue(date, format)

Converts date stored in text to an actual date object and formats it using strftime formatting.

It will fallback to "%Y-%m-%d %H:%M:%S" if no formatting is supplied

Example 1: Convert from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Date: "2022-01-01" when used with the following context:

%{"date" => %{"__value__" => "2022-01-01", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = datevalue(date).date
# When used in a piece of text prefix it with an `@`
my_var = "@datevalue(date).date"
end

Example 2: Convert a date value and read the date field

When used as a Journey expression it returns a value of type Date: "2022-01-01".

card MyCard do
my_var = datevalue(date(2022, 1, 1)).date
# When used in a piece of text prefix it with an `@`
my_var = "@datevalue(date(2022, 1, 1)).date"
end

Example 3: Convert a date from a piece of text and read the date field

When used as a Journey expression it returns a value of type Date: "2022-01-01".

card MyCard do
my_var = datevalue("2022-01-01").date
# When used in a piece of text prefix it with an `@`
my_var = "@datevalue(\"2022-01-01\").date"
end

Example 4: Convert a date from a piece of text to a formatted date string

When used as a Journey expression it returns a complex String type of default value:

"2022-01-01 00:00:00"

with the following fields:

  • date of type Date
  • datetime of type DateTime.
card MyCard do
my_var = datevalue("2022-01-01")
# When used in a piece of text prefix it with an `@`
my_var = "@datevalue(\"2022-01-01\")"
end

datevalue(date)


day(date)

Returns only the day of the month of a date (1 to 31)

Example 1: Return day from date in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 29 when used with the following context:

%{"date" => %{"__value__" => ~U[2016-02-29 22:25:00Z], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = day(date)
# When used in a piece of text prefix it with an `@`
my_var = "@day(date)"
end

Example 2: Getting today's day of the month

When used as a Journey expression it returns a value of type Integer: 18.

card MyCard do
my_var = day(now())
# When used in a piece of text prefix it with an `@`
my_var = "@day(now())"
end

Example 3: Getting today's day of the month

When used as a Journey expression it returns a value of type Integer: 10.

card MyCard do
my_var = day(date(2022, 9, 10))
# When used in a piece of text prefix it with an `@`
my_var = "@day(date(2022, 9, 10))"
end

edate(date, months)

Moves a date by the given number of months

Example 1: Move the date from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Date: "2022-11-10" when used with the following context:

%{"date" => %{"__value__" => "2022-10-10", "display" => "value for display key", "value" => "value for value key"}, "months" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = edate(date, months)
# When used in a piece of text prefix it with an `@`
my_var = "@edate(date, months)"
end

Example 2: Move the date store in a piece of text by 1 month

When used as a Journey expression it returns a value of type Date: "2022-11-10".

card MyCard do
my_var = edate("2022-10-10", 1)
# When used in a piece of text prefix it with an `@`
my_var = "@edate(\"2022-10-10\", 1)"
end

Example 3: Move the date in a date object by 1 month

When used as a Journey expression it returns a value of type DateTime: "2022-02-01T00:00:00Z" when used with the following context:

%{right_now: ~U[2022-01-01 00:00:00Z]}
card MyCard do
my_var = edate(right_now, 1)
# When used in a piece of text prefix it with an `@`
my_var = "@edate(right_now, 1)"
end

hour(date)

Returns only the hour of a datetime (0 to 23)

Example 1: Get the hour from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 3 when used with the following context:

%{"date" => %{"__value__" => ~U[2022-07-31 03:00:00Z], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = hour(date)
# When used in a piece of text prefix it with an `@`
my_var = "@hour(date)"
end

Example 2: Get the current hour

When used as a Journey expression it returns a value of type Integer: 13.

card MyCard do
my_var = hour(now())
# When used in a piece of text prefix it with an `@`
my_var = "@hour(now())"
end

minute(date)

Returns only the minute of a datetime (0 to 59)

Example 1: Get the minute from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 23 when used with the following context:

%{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = minute(date)
# When used in a piece of text prefix it with an `@`
my_var = "@minute(date)"
end

Example 2: Get the current minute

When used as a Journey expression it returns a value of type Integer: 19.

card MyCard do
my_var = minute(now())
# When used in a piece of text prefix it with an `@`
my_var = "@minute(now())"
end

month(date)

Returns only the month of a date (1 to 12)

Example 1: Get the month from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 7 when used with the following context:

%{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = month(date)
# When used in a piece of text prefix it with an `@`
my_var = "@month(date)"
end

Example 2: Get the current month

When used as a Journey expression it returns a value of type Integer: 8.

card MyCard do
my_var = month(now())
# When used in a piece of text prefix it with an `@`
my_var = "@month(now())"
end

now()

Returns the current date time as UTC

It is currently @NOW()

Example 1: return the current datetime and format it using datevalue

When used as a Journey expression it returns a complex String type of default value:

"2026-08-18"

with the following fields:

  • date of type Date
  • datetime of type DateTime.
card MyCard do
my_var = datevalue(now(), "%Y-%m-%d")
# When used in a piece of text prefix it with an `@`
my_var = "@datevalue(now(), \"%Y-%m-%d\")"
end

Example 2: return the current timestamp as a DateTime value

When used as a Journey expression it returns a value of type DateTime: "2026-08-18T13:19:04.458827Z".

card MyCard do
my_var = now()
# When used in a piece of text prefix it with an `@`
my_var = "@now()"
end

parse_datevalue(datetime, format)

Parse random dates and times with strftime patterns and return a DateTime value when it matches.

Example 1: Parse value in value key if complex values are provided.

When used as a Journey expression it returns a value of type DateTime: "2016-02-29T22:25:00Z" when used with the following context:

%{"datetime" => %{"__value__" => "2016-02-29T22:25:00-00:00", "display" => "value for display key", "value" => "value for value key"}, "format" => %{"__value__" => "%FT%T%:z", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = parse_datevalue(datetime, format)
# When used in a piece of text prefix it with an `@`
my_var = "@parse_datevalue(datetime, format)"
end

Example 2: Attempt to parse a date value and return nil when failing

When used as a Journey expression it returns a value of type Null: null.

card MyCard do
my_var = parse_datevalue("👻👻👻👻", "%FT%T%:z")
# When used in a piece of text prefix it with an `@`
my_var = "@parse_datevalue(\"👻👻👻👻\", \"%FT%T%:z\")"
end

Example 3: Parse a date value using strftime formatting and return a DateTime

When used as a Journey expression it returns a value of type DateTime: "2016-02-29T22:25:00Z".

card MyCard do
my_var = parse_datevalue("2016-02-29T22:25:00-00:00", "%FT%T%:z")
# When used in a piece of text prefix it with an `@`
my_var = "@parse_datevalue(\"2016-02-29T22:25:00-00:00\", \"%FT%T%:z\")"
end

second(date)

Returns only the second of a datetime (0 to 59)

Example 1: Get the second from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 15 when used with the following context:

%{"date" => %{"__value__" => ~U[2022-07-31 03:23:15Z], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = second(date)
# When used in a piece of text prefix it with an `@`
my_var = "@second(date)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 11 when used with the following context:

%{"now" => ~U[2026-08-13 19:41:11.142095Z]}
card MyCard do
my_var = second(now)
# When used in a piece of text prefix it with an `@`
my_var = "@second(now)"
end

time(hours, minutes, seconds)

Defines a time value which can be used for time arithmetic

Example 1: Create a time from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Time: "12:13:14" when used with the following context:

%{"hour" => %{"__value__" => 12, "display" => "value for display key", "value" => "value for value key"}, "minute" => %{"__value__" => 13, "display" => "value for display key", "value" => "value for value key"}, "second" => %{"__value__" => 14, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = time(hour, minute, second)
# When used in a piece of text prefix it with an `@`
my_var = "@time(hour, minute, second)"
end

Example 2:

When used as a Journey expression it returns a value of type Time: "12:13:14".

card MyCard do
my_var = time(12, 13, 14)
# When used in a piece of text prefix it with an `@`
my_var = "@time(12, 13, 14)"
end

timevalue(expression)

Converts time stored in text to an actual time

Example 1: Create a time from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Time: "02:30:00" when used with the following context:

%{"time" => %{"__value__" => "2:30", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = timevalue(time)
# When used in a piece of text prefix it with an `@`
my_var = "@timevalue(time)"
end

Example 2:

When used as a Journey expression it returns a value of type Time: "02:30:55".

card MyCard do
my_var = timevalue("2:30:55")
# When used in a piece of text prefix it with an `@`
my_var = "@timevalue(\"2:30:55\")"
end

Example 3:

When used as a Journey expression it returns a value of type Time: "02:30:00".

card MyCard do
my_var = timevalue("2:30")
# When used in a piece of text prefix it with an `@`
my_var = "@timevalue(\"2:30\")"
end

today()

Returns the current date

Example 1:

When used as a Journey expression it returns a value of type Date: "2026-08-18".

card MyCard do
my_var = today()
# When used in a piece of text prefix it with an `@`
my_var = "@today()"
end

weekday(date)

Returns the day of the week of a date (1 for Sunday to 7 for Saturday)

Example 1: Return day of week from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 1 when used with the following context:

%{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = weekday(date)
# When used in a piece of text prefix it with an `@`
my_var = "@weekday(date)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 3 when used with the following context:

%{"today" => ~D[2022-11-01]}
card MyCard do
my_var = weekday(today)
# When used in a piece of text prefix it with an `@`
my_var = "@weekday(today)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 1 when used with the following context:

%{"today" => ~D[2022-11-06]}
card MyCard do
my_var = weekday(today)
# When used in a piece of text prefix it with an `@`
my_var = "@weekday(today)"
end

year(date)

Returns only the year of a date

Example 1: Return year from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Integer: 2022 when used with the following context:

%{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = year(date)
# When used in a piece of text prefix it with an `@`
my_var = "@year(date)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 2026 when used with the following context:

%{"now" => ~U[2026-08-13 19:41:11.144458Z]}
card MyCard do
my_var = year(now)
# When used in a piece of text prefix it with an `@`
my_var = "@year(now)"
end

Enum

append(list, payload)

Appends an item or a list of items to a given list.

Example 1: Appends an item or a list of items to a given list from value keys if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"A",
"B",
"C"
]

when used with the following context:

%{"list" => %{"__value__" => ["A", "B"], "display" => "value for display key", "value" => "value for value key"}, "payload" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = append(list, payload)
# When used in a piece of text prefix it with an `@`
my_var = "@append(list, payload)"
end

Example 2:

When used as a Journey expression it returns a value of type List with values String, String, String, String:

[
"A",
"B",
"C",
"B"
]
card MyCard do
my_var = append(["A", "B"], ["C", "B"])
# When used in a piece of text prefix it with an `@`
my_var = "@append([\"A\", \"B\"], [\"C\", \"B\"])"
end

Example 3:

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"A",
"B",
"C"
]
card MyCard do
my_var = append(["A", "B"], "C")
# When used in a piece of text prefix it with an `@`
my_var = "@append([\"A\", \"B\"], \"C\")"
end

chunk_every(enumerable, count)

Chunk a list into a list of smaller lists.

This is useful in cases where one has a large list but want to process them in smaller chunks.

Example 1: Split enum in value key if complex value is provided.

When used as a Journey expression it returns a value of type List with values List with values String, String, String, List with values String, String:

[
[
"the first sentence",
"the second sentence",
"the third sentence"
],
[
"the fourth sentence",
"the fifth sentence"
]
]

when used with the following context:

%{"complex" => %{"__value__" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = chunk_every(complex, 3)
# When used in a piece of text prefix it with an `@`
my_var = "@chunk_every(complex, 3)"
end

Example 2: If an invalid, non-enumerable value is passed, return an error

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = chunk_every(nil, 2)
# When used in a piece of text prefix it with an `@`
my_var = "@chunk_every(nil, 2)"
end

Example 3: Split a large set of sentences into a smaller set of sentences.

When used as a Journey expression it returns a value of type List with values List with values String, String, List with values String, String, List with values String:

[
[
"the first sentence",
"the second sentence"
],
[
"the third sentence",
"the fourth sentence"
],
[
"the fifth sentence"
]
]

when used with the following context:

%{"sentences" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"]}
card MyCard do
my_var = chunk_every(sentences, 2)
# When used in a piece of text prefix it with an `@`
my_var = "@chunk_every(sentences, 2)"
end

count(term)

Return the number of entries in a list, string, or a map.

Example 1: Count value in value key if complex value is provided.

When used as a Journey expression it returns a value of type Integer: 23 when used with the following context:

%{"enum" => %{"__value__" => "value for __value__ key", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = count(enum)
# When used in a piece of text prefix it with an `@`
my_var = "@count(enum)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 0 when used with the following context:

%{"nil_value" => nil}
card MyCard do
my_var = count(nil_value)
# When used in a piece of text prefix it with an `@`
my_var = "@count(nil_value)"
end

Example 3:

When used as a Journey expression it returns a value of type Integer: 1 when used with the following context:

%{"map" => %{"foo" => "bar"}}
card MyCard do
my_var = count(map)
# When used in a piece of text prefix it with an `@`
my_var = "@count(map)"
end

Example 4:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = count("zoë")
# When used in a piece of text prefix it with an `@`
my_var = "@count(\"zoë\")"
end

Example 5:

When used as a Journey expression it returns a value of type Integer: 3.

card MyCard do
my_var = count([1, 2, 3])
# When used in a piece of text prefix it with an `@`
my_var = "@count([1, 2, 3])"
end

delete(map, key)

Deletes an element from a map by the given key.

Example 1: Deletes an element from a map by the given key from value keys if complex values are provided.

When used as a Journey expression it returns a value of type Map:

{
"age": 32
}

when used with the following context:

%{"key" => %{"__value__" => "gender", "display" => "value for display key", "value" => "value for value key"}, "map" => %{"__value__" => %{"age" => 32, "gender" => "?"}, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = delete(map, key)
# When used in a piece of text prefix it with an `@`
my_var = "@delete(map, key)"
end

Example 2:

When used as a Journey expression it returns a value of type Map:

{
"age": 32
}

when used with the following context:

%{"patient" => %{"age" => 32, "gender" => "?"}}
card MyCard do
my_var = delete(patient, "gender")
# When used in a piece of text prefix it with an `@`
my_var = "@delete(patient, \"gender\")"
end

filter(enumerable, filter_fun)

Filters a list by returning a new list that contains only the elements for which filter_fun is truthy.

Example 1: Filter from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String:

[
"B",
"B"
]

when used with the following context:

%{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = filter(list, & &1 == "B")
# When used in a piece of text prefix it with an `@`
my_var = "@filter(list, & &1 == \"B\")"
end

Example 2: If an invalid, non-enumerable value is passed, return an error

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = filter(nil, & &1 == "B")
# When used in a piece of text prefix it with an `@`
my_var = "@filter(nil, & &1 == \"B\")"
end

Example 3:

When used as a Journey expression it returns a value of type List with values String, String:

[
"B",
"B"
]
card MyCard do
my_var = filter(["A", "B", "C", "B"], & &1 == "B")
# When used in a piece of text prefix it with an `@`
my_var = "@filter([\"A\", \"B\", \"C\", \"B\"], & &1 == \"B\")"
end

find(enumerable, find_fun)

Finds the first element in the list for which filter_fun is truthy.

Example 1: Find from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String:

[
"Hi",
"World"
]

when used with the following context:

%{"list" => %{"__value__" => [["Hello", "World"], ["Hi", "World"]], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = find(list, & &1[0] == "Hi")
# When used in a piece of text prefix it with an `@`
my_var = "@find(list, & &1[0] == \"Hi\")"
end

Example 2:

When used as a Journey expression it returns a value of type List with values String, String:

[
"Hi",
"World"
]
card MyCard do
my_var = find([["Hello", "World"], ["Hi", "World"]], & &1[0] == "Hi")
# When used in a piece of text prefix it with an `@`
my_var = "@find([[\"Hello\", \"World\"], [\"Hi\", \"World\"]], & &1[0] == \"Hi\")"
end

has_all_members(list, items)

Return true if a list contains all the provided items

Example 1: Return boolean indicating if a list contains all items from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"items" => %{"__value__" => ["C", "B"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_all_members(list, items)
# When used in a piece of text prefix it with an `@`
my_var = "@has_all_members(list, items)"
end

Example 2: Check whether the given list contains all the provided items

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_all_members(["A", "B", "C"], ["C", "B"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_all_members([\"A\", \"B\", \"C\"], [\"C\", \"B\"])"
end

has_any_member(list, items)

Return true if a list contains any of the provided items

Example 1: Return boolean indicating if a list contains any items from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"items" => %{"__value__" => ["Z", "C"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_any_member(list, items)
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_member(list, items)"
end

Example 2: Check whether the given list contains any of the provided items

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_any_member(["A", "B", "C"], ["Z", "C"])
# When used in a piece of text prefix it with an `@`
my_var = "@has_any_member([\"A\", \"B\", \"C\"], [\"Z\", \"C\"])"
end

has_group(groups, uuid)

Returns whether the contact is part of group with the passed in UUID

Example 1: Returns whether the groups contain the given uuid from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: false when used with the following context:

%{"groups" => %{"__value__" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}], "display" => "value for display key", "value" => "value for value key"}, "uuid" => %{"__value__" => "00000000-0000-0000-0000-000000000000", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_group(groups, uuid)
# When used in a piece of text prefix it with an `@`
my_var = "@has_group(groups, uuid)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false when used with the following context:

%{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}}
card MyCard do
my_var = has_group(contact.groups, "00000000-0000-0000-0000-000000000000")
# When used in a piece of text prefix it with an `@`
my_var = "@has_group(contact.groups, \"00000000-0000-0000-0000-000000000000\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}}
card MyCard do
my_var = has_group(contact.groups, "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d")
# When used in a piece of text prefix it with an `@`
my_var = "@has_group(contact.groups, \"b7cf0d83-f1c9-411c-96fd-c511a4cfa86d\")"
end

has_member(list, item)

Return true if a list has the given item as a member

Example 1: Check whether the given list has the item as a member from value keys if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"item" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = has_member(list, item)
# When used in a piece of text prefix it with an `@`
my_var = "@has_member(list, item)"
end

Example 2: Check whether the given list has the item as a member

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = has_member(["A", "B", "C"], "C")
# When used in a piece of text prefix it with an `@`
my_var = "@has_member([\"A\", \"B\", \"C\"], \"C\")"
end

json(data)

Converts a data structure to JSON

Example 1: Converts data from value key to JSON if complex values are provided.

When used as a Journey expression it returns a value of type String: "{\"foo\":\"bar\"}" when used with the following context:

%{"data" => %{"__value__" => %{"foo" => "bar"}, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = json(data)
# When used in a piece of text prefix it with an `@`
my_var = "@json(data)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "{\"foo\":\"bar\"}" when used with the following context:

%{"data" => %{"foo" => "bar"}}
card MyCard do
my_var = json(data)
# When used in a piece of text prefix it with an `@`
my_var = "@json(data)"
end

map(enumerable, mapper)

map over a list of items and apply the mapper function to every item, returning the result.

Example 1: Map over a list of items from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values Date, Date, Date:

[
"2022-01-01",
"2022-01-02",
"2022-01-03"
]

when used with the following context:

%{"expression" => %{"__value__" => 1..3, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = map(expression, &date(2022, 1, &1))
# When used in a piece of text prefix it with an `@`
my_var = "@map(expression, &date(2022, 1, &1))"
end

Example 2: If an invalid, non-enumerable value is passed, return an error

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = map(nil, &(&1 * &1))
# When used in a piece of text prefix it with an `@`
my_var = "@map(nil, &(&1 * &1))"
end

Example 3: Map over the range of numbers, multiple each by itself and return the result

When used as a Journey expression it returns a value of type List with values Integer, Integer, Integer:

[
1,
4,
9
]
card MyCard do
my_var = map(1..3, &(&1 * &1))
# When used in a piece of text prefix it with an `@`
my_var = "@map(1..3, &(&1 * &1))"
end

Example 4: Map over the range of numbers, create a date in January for every number

When used as a Journey expression it returns a value of type List with values Date, Date, Date:

[
"2022-01-01",
"2022-01-02",
"2022-01-03"
]
card MyCard do
my_var = map(1..3, &date(2022, 1, &1))
# When used in a piece of text prefix it with an `@`
my_var = "@map(1..3, &date(2022, 1, &1))"
end

parse_json(data)

Parses a string as JSON when given a String which is assumed to be JSON encoded.

Will return whatever was supplied as is when the given argument is not a String.

Example 1: Parses JSON from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values Integer, Integer, Integer:

[
1,
2,
3
]

when used with the following context:

%{"string" => %{"__value__" => "[1,2,3]", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = parse_json(string)
# When used in a piece of text prefix it with an `@`
my_var = "@parse_json(string)"
end

Example 2:

When used as a Journey expression it returns a value of type List with values Integer, Integer, Integer:

[
1,
2,
3
]
card MyCard do
my_var = parse_json('[1,2,3]')
# When used in a piece of text prefix it with an `@`
my_var = "@parse_json('[1,2,3]')"
end

Example 3:

When used as a Journey expression it returns a value of type List with values Integer, Integer, Integer:

[
1,
2,
3
]
card MyCard do
my_var = parse_json('[1,2,3]')
# When used in a piece of text prefix it with an `@`
my_var = "@parse_json('[1,2,3]')"
end

reduce(enumerable, accumulator, reducer)

Reduces elements from a list by applying a function and collecting the results in an accumulator.

The first argument to the lambda function is the item from the list, the second argument is the accumulator.

Example 1: If an invalid, non-enumerable value is passed, return an error

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = reduce(nil, 0, & &1 + &2)
# When used in a piece of text prefix it with an `@`
my_var = "@reduce(nil, 0, & &1 + &2)"
end

Example 2:

When used as a Journey expression it returns a value of type Integer: 6.

card MyCard do
my_var = reduce(1..3, 0, & &1 + &2)
# When used in a piece of text prefix it with an `@`
my_var = "@reduce(1..3, 0, & &1 + &2)"
end

reject(enumerable, reject_fun)

Rejects elements from a list by returning a new list that contains only the elements for which reject_fun is truthy.

Example 1: Return list with rejected items from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String:

[
"A",
"C"
]

when used with the following context:

%{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = reject(list, & &1 == "B")
# When used in a piece of text prefix it with an `@`
my_var = "@reject(list, & &1 == \"B\")"
end

Example 2: If an invalid, non-enumerable value is passed, return an error

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = reject(nil, & &1 == "B")
# When used in a piece of text prefix it with an `@`
my_var = "@reject(nil, & &1 == \"B\")"
end

Example 3:

When used as a Journey expression it returns a value of type List with values String, String:

[
"A",
"C"
]
card MyCard do
my_var = reject(["A", "B", "C", "B"], & &1 == "B")
# When used in a piece of text prefix it with an `@`
my_var = "@reject([\"A\", \"B\", \"C\", \"B\"], & &1 == \"B\")"
end

sort_by(enumerable, sorter_fun)

Sorts a list of values using the result of the sorter function

Example 1: Return list with unique items from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"a",
"c",
"b"
]

when used with the following context:

%{"list" => %{"__value__" => ["a", "c", "b"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = sort_by(list, & &1 < &2)
# When used in a piece of text prefix it with an `@`
my_var = "@sort_by(list, & &1 < &2)"
end

Example 2: If an invalid, non-enumerable value is passed, return an error

When used as a Journey expression it returns a complex Null type of default value:

null

with the following fields:

  • type of type String
  • error of type Boolean
  • message of type String.
card MyCard do
my_var = sort_by(nil, &rand_between(1, 5))
# When used in a piece of text prefix it with an `@`
my_var = "@sort_by(nil, &rand_between(1, 5))"
end

Example 3:

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"b",
"a",
"c"
]
card MyCard do
my_var = sort_by(["a", "b", "c"], &rand_between(1, 5))
# When used in a piece of text prefix it with an `@`
my_var = "@sort_by([\"a\", \"b\", \"c\"], &rand_between(1, 5))"
end

uniq(enumerable)

Removes duplicate values from a list.

Example 1: Return list with unique items from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"A",
"B",
"C"
]

when used with the following context:

%{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = uniq(list)
# When used in a piece of text prefix it with an `@`
my_var = "@uniq(list)"
end

Example 2:

When used as a Journey expression it returns a value of type List with values String, String, String:

[
"A",
"B",
"C"
]
card MyCard do
my_var = uniq(["A", "B", "C", "B"])
# When used in a piece of text prefix it with an `@`
my_var = "@uniq([\"A\", \"B\", \"C\", \"B\"])"
end

with_index(enumerable)

Wraps each item of the list in a new list with the item itself and its index in the original list.

Example 1: Return list with indexes from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type List with values List with values String, Integer, List with values String, Integer, List with values String, Integer:

[
[
"A",
0
],
[
"B",
1
],
[
"C",
2
]
]

when used with the following context:

%{"val1" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => "B", "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = with_index([val1, val2, val3])
# When used in a piece of text prefix it with an `@`
my_var = "@with_index([val1, val2, val3])"
end

Example 2:

When used as a Journey expression it returns a value of type List with values List with values String, Integer, List with values String, Integer, List with values String, Integer:

[
[
"A",
0
],
[
"B",
1
],
[
"C",
2
]
]
card MyCard do
my_var = with_index(["A", "B", "C"])
# When used in a piece of text prefix it with an `@`
my_var = "@with_index([\"A\", \"B\", \"C\"])"
end

Logical

and(argument1, argument2, argument3)

Returns true if and only if all its arguments evaluate to true

Example 1: Return true if value in value key if complex values are provided evaluates to true.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"age" => %{"__value__" => 18, "display" => "value for display key", "value" => "value for value key"}, "gender" => %{"__value__" => "F", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = gender = "F" and age >= 18
# When used in a piece of text prefix it with an `@`
my_var = "@and(gender = \"F\", age >= 18)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false when used with the following context:

%{"contact" => %{"age" => 32, "gender" => "?"}}
card MyCard do
my_var = contact.gender = "F" and contact.age >= 18
# When used in a piece of text prefix it with an `@`
my_var = "@and(contact.gender = \"F\", contact.age >= 18)"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"contact" => %{"age" => 32, "gender" => "F"}}
card MyCard do
my_var = contact.gender = "F" and contact.age >= 18
# When used in a piece of text prefix it with an `@`
my_var = "@and(contact.gender = \"F\", contact.age >= 18)"
end

boolean(value)

Converts a value to a boolean.

Nil, false, 0, 0.0, and empty string become false. Everything else becomes true.

Example 1: Convert from value in value key if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"value" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = boolean(value)
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(value)"
end

Example 2: A boolean passes through

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = boolean(true)
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(true)"
end

Example 3: Non-empty string is true

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = boolean("hello")
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(\"hello\")"
end

Example 4: Non-zero number is true

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = boolean(1)
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(1)"
end

Example 5: Empty string is false

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = boolean("")
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(\"\")"
end

Example 6: Zero is false

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = boolean(0)
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(0)"
end

Example 7: Nil is false

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = boolean(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@boolean(nil)"
end

if(condition, yes, no)

Returns one value if the condition evaluates to true, and another value if it evaluates to false

Example 1:

When used as a Journey expression it returns a value of type String: "No" when used with the following context:

%{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "value1" => %{"__value__" => "Yes", "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => "No", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = if(boolean, value1, value2)
# When used in a piece of text prefix it with an `@`
my_var = "@if(boolean, value1, value2)"
end

Example 2:

When used as a Journey expression it returns a value of type String: "No".

card MyCard do
my_var = # Shorthand
if(false, do: "Yes", else: "No")
# When used in a piece of text prefix it with an `@`
my_var = "@if(false, \"Yes\", \"No\")"
end

Example 3:

When used as a Journey expression it returns a value of type String: "Yes".

card MyCard do
my_var = if true do
"Yes"
else
"No"
end

# When used in a piece of text prefix it with an `@`
my_var = "@if(true, \"Yes\", \"No\")"
end

is_error(value)

Checks whether value is an error

Example 1:

When used as a Journey expression it returns a value of type Boolean: false when used with the following context:

%{}
card MyCard do
my_var = is_error("not an error")
# When used in a piece of text prefix it with an `@`
my_var = "@is_error(\"not an error\")"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "the error"}}
card MyCard do
my_var = is_error(error)
# When used in a piece of text prefix it with an `@`
my_var = "@is_error(error)"
end

is_nil_or_empty(arg)

Returns true if the argument is nil or an empty string

Example 1: Return true if value in value key if complex values are provided is nil or an empty string.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"argument" => %{"__value__" => "", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = is_nil_or_empty(argument)
# When used in a piece of text prefix it with an `@`
my_var = "@is_nil_or_empty(argument)"
end

Example 2: Check whether the given argument is nil or an empty string

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = is_nil_or_empty(nil)
# When used in a piece of text prefix it with an `@`
my_var = "@is_nil_or_empty(nil)"
end

isbool(var)

Returns true if the argument is a boolean.

Example 1: Return boolean indicating if value in value key is a boolean if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"string" => %{"__value__" => true, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = isbool(string)
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(string)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isbool("false")
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(\"false\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isbool("true")
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(\"true\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isbool(0)
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(0)"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isbool(1)
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(1)"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = isbool(false)
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(false)"
end

Example 7:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = isbool(true)
# When used in a piece of text prefix it with an `@`
my_var = "@isbool(true)"
end

isnumber(var)

Returns true if the argument is a number.

Example 1: Return boolean indicating if value in value key is a number if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"string" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = isnumber(string)
# When used in a piece of text prefix it with an `@`
my_var = "@isnumber(string)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isnumber("a")
# When used in a piece of text prefix it with an `@`
my_var = "@isnumber(\"a\")"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = isnumber("1.0")
# When used in a piece of text prefix it with an `@`
my_var = "@isnumber(\"1.0\")"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = isnumber(1.0)
# When used in a piece of text prefix it with an `@`
my_var = "@isnumber(1.0)"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = isnumber(1)
# When used in a piece of text prefix it with an `@`
my_var = "@isnumber(1)"
end

isstring(binary)

Returns true if the argument is a string.

Example 1: Return boolean indicating if value in value key is a string if complex values are provided.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"string" => %{"__value__" => "hello", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = isstring(string)
# When used in a piece of text prefix it with an `@`
my_var = "@isstring(string)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isstring(1)
# When used in a piece of text prefix it with an `@`
my_var = "@isstring(1)"
end

Example 3:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = isstring(false)
# When used in a piece of text prefix it with an `@`
my_var = "@isstring(false)"
end

Example 4:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = isstring("hello")
# When used in a piece of text prefix it with an `@`
my_var = "@isstring(\"hello\")"
end

not(argument)

Returns false if the argument supplied evaluates to truth-y

Example 1: Return false if value in value key if complex values are provided evaluates to truth-y.

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = not(boolean)
# When used in a piece of text prefix it with an `@`
my_var = "@not(boolean)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = not(false)
# When used in a piece of text prefix it with an `@`
my_var = "@not(false)"
end

or(argument1, argument2, argument3)

Returns true if any argument is true. Returns the first truthy value found or otherwise false.

Accepts any amount of arguments for testing truthiness.

Example 1:

When used as a Journey expression it returns a value of type String: "b" when used with the following context:

%{"a" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "b" => %{"__value__" => "b", "display" => "value for display key", "value" => "value for value key"}}
card MyCard do
my_var = or(a, b)
# When used in a piece of text prefix it with an `@`
my_var = "@or(a, b)"
end

Example 2:

When used as a Journey expression it returns a value of type Boolean: false when used with the following context:

%{}
card MyCard do
my_var = b or b
# When used in a piece of text prefix it with an `@`
my_var = "@or(b, b)"
end

Example 3:

When used as a Journey expression it returns a value of type String: "a" when used with the following context:

%{"a" => "a", "b" => false}
card MyCard do
my_var = a or b
# When used in a piece of text prefix it with an `@`
my_var = "@or(a, b)"
end

Example 4:

When used as a Journey expression it returns a value of type String: "bee" when used with the following context:

%{"a" => false, "b" => "bee"}
card MyCard do
my_var = a or b
# When used in a piece of text prefix it with an `@`
my_var = "@or(a, b)"
end

Example 5:

When used as a Journey expression it returns a value of type Boolean: false.

card MyCard do
my_var = false or false
# When used in a piece of text prefix it with an `@`
my_var = "@or(false, false)"
end

Example 6:

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = true or true
# When used in a piece of text prefix it with an `@`
my_var = "@or(true, true)"
end

Example 7: Return the first value that is truthy

When used as a Journey expression it returns a value of type String: "foo".

card MyCard do
my_var = false or "foo"
# When used in a piece of text prefix it with an `@`
my_var = "@or(false, \"foo\")"
end

Example 8: Return true if any of the values are true

When used as a Journey expression it returns a value of type Boolean: true.

card MyCard do
my_var = true or false
# When used in a piece of text prefix it with an `@`
my_var = "@or(true, false)"
end

switch(argument1, argument2, argument3)

Example 1: The SWITCH function evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value. If there is no match, an optional default value (the last one in the list if the list is odd) may be returned

When used as a Journey expression it returns a value of type String: "No match".

card MyCard do
my_var = SWITCH(5, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match")
# When used in a piece of text prefix it with an `@`
my_var = "@SWITCH(5, 1, \"Sunday\", 2, \"Monday\", 3, \"Tuesday\", \"No match\")"
end

Example 2: The SWITCH function evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value. If there is no match, an optional default value (the last one in the list if the list is odd) may be returned

When used as a Journey expression it returns a value of type String: "Sunday".

card MyCard do
my_var = SWITCH(1, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match")
# When used in a piece of text prefix it with an `@`
my_var = "@SWITCH(1, 1, \"Sunday\", 2, \"Monday\", 3, \"Tuesday\", \"No match\")"
end

Data

attachment_url(media_id)

Generate a URL for the given media ID that is valid for 15 minutes.

Example 1: Return a URL for an attachment that is valid for 15 minutes.

When used as a Journey expression it returns a value of type String: "https://example.org/attachment-url".

card MyCard do
my_var = attachment_url(event.message.image.id)
# When used in a piece of text prefix it with an `@`
my_var = "@attachment_url(event.message.image.id)"
end

close_chat()

Closes the current chat with an optional reason.

This function closes the chat in the current context by setting its state to "CLOSED". If no reason is provided, it generates a default reason based on the journey name.

It uses the Chats.close_chat/4 function to perform the operation which handles all required side effects such as marking the chat as handled, publishing stats updates, etc.

The recorded closing event reason is set to :journey_completion which is appropriate for journey-initiated closures.

Examples

With explicit reason

close_chat("Survey completed successfully")

Without reason (uses journey name and uuid)

close_chat() # -> "Chat closed by journey: [Journey Name] - [Journey UUID]"

Example 1:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • type of type String.
card MyCard do
my_var = close_chat("Journey completed successfully")
# When used in a piece of text prefix it with an `@`
my_var = "@close_chat(\"Journey completed successfully\")"
end

Example 2:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • type of type String.
card MyCard do
my_var = close_chat()
# When used in a piece of text prefix it with an `@`
my_var = "@close_chat()"
end

cull_data(%)

Permanently deletes all messages, contacts, contact details, attachments, and everything else related to a chat.

Example 1:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • type of type String.
card MyCard do
my_var = cull_data()
# When used in a piece of text prefix it with an `@`
my_var = "@cull_data()"
end

cull_data()


generate_ott(data)

Generates a One Time Token which can exchanged for a JWT for a single contact's profile information via the /t/<token> endpoint. The JWT token returned can be used with the /v1/contacts/<contact_id>/profile endpoint to retrieve the contact's details.

Example 1:

When used as a Journey expression it returns a value of type String: "99x2asd1".

card MyCard do
my_var = generate_ott("metadata")
# When used in a piece of text prefix it with an `@`
my_var = "@generate_ott(\"metadata\")"
end

get_collected_data()

Retrieves the data related to the current session such as processed messages, contact details and number information.

Example 1:

When used as a Journey expression it returns a value of type String: "{\"contacts\":[{\"profile\":{\"name\":\"John Doe\"},\"wa_id\":\"1234567890\"}],\"messages\":[{\"text\":{\"body\":\"hi\"}},{\"image\":{\"caption\":\"What is your name?\"},\"type\":\"image\"},{\"text\":{\"body\":\"user message\"}}],\"thread\":{\"contact\":{\"name\":\"John Doe\"}}}".

card MyCard do
my_var = get_collected_data()
# When used in a piece of text prefix it with an `@`
my_var = "@get_collected_data()"
end

get_write_results_data()

Get the flow results captured for the current contact in the current stack.

Example 1:

When used as a Journey expression it returns a value of type String: "{\"chat\":\"current chat...\",\"contact\":\"current contact...\",\"number\":\"current number...\",\"results\":[{\"question\":\"the question reference...\",\"question_id\":\"question unique-id...\",\"response\":\"the response...\",\"response_metadata\":\"the response metadata...\"}],\"session\":\"current session object...\",\"stack\":\"current stack...\"}".

card MyCard do
my_var = get_write_results_data()
# When used in a piece of text prefix it with an `@`
my_var = "@get_write_results_data()"
end

scrub_message_by_id(id)

Permanently scrubs a message by its given ID.

Example 1:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • type of type String.
card MyCard do
my_var = scrub_message_by_id(event.message.id)
# When used in a piece of text prefix it with an `@`
my_var = "@scrub_message_by_id(event.message.id)"
end

scrub_session_messages()

Permanently scrubs all the processed messages during the current session.

Example 1:

When used as a Journey expression it returns a complex Boolean type of default value:

true

with the following fields:

  • type of type String.
card MyCard do
my_var = scrub_session_messages()
# When used in a piece of text prefix it with an `@`
my_var = "@scrub_session_messages()"
end

Huggingface

hf_connect(model_resource, token)

Connect a Huggingface model. The variable returned represents the connection to the Huggingface model and should be used as the connection argument to the hf_infer function.

Example 1: Connect to a model available on a custom Huggingface domain

When used as a Journey expression it returns a complex String type of default value:

"huggingface.co connection for \"/myhuggingface/model\""

with the following fields:

  • type of type String
  • token of type String
  • url of type String.
card MyCard do
my_var = hf_connect("https://my-custom-domain.com/myhuggingface/model", "my-token")
# When used in a piece of text prefix it with an `@`
my_var = "@hf_connect(\"https://my-custom-domain.com/myhuggingface/model\", \"my-token\")"
end

Example 2: Connect to a model available on Huggingface.

Note that the the first argument is not a URL, but a reference to a Huggingface model in the format of "organisation-name/model-name" similar to how one might refer to a Github repository.

When used as a Journey expression it returns a complex String type of default value:

"huggingface.co connection for \"/models/myhuggingface/model\""

with the following fields:

  • type of type String
  • token of type String
  • url of type String.
card MyCard do
my_var = hf_connect("myhuggingface/model", "my-token")
# When used in a piece of text prefix it with an `@`
my_var = "@hf_connect(\"myhuggingface/model\", \"my-token\")"
end

hf_infer(hf_connect, query)

Call the Huggingface inference API for the connection stored in the hf_connect variable.

Example 1: Use the Huggingface inference API to submit an input query to a model specified in the connection variable. The value returned is the decoded JSON payload returned by the model hosted on Huggingface.

When used as a Journey expression it returns a value of type String: "nil is not a valid Huggingface connection.".

card MyCard do
my_var = hf_infer(conn, "I am so happy today")
# When used in a piece of text prefix it with an `@`
my_var = "@hf_infer(conn, \"I am so happy today\")"
end

Google

google_connect(service_account)

Connect with Google's APIs using the service account provided.

Example 1: The first argument is the service account for Google as a String. Please refer to Google's documentation on how to create a service account.

When used as a Journey expression it returns a value of type String: "an-api-access-token".

card MyCard do
my_var = google_connect("service-account-details")
# When used in a piece of text prefix it with an `@`
my_var = "@google_connect(\"service-account-details\")"
end

google_read_sheet(token, spreadsheet_id, sheet_name, cache_ttl)

Read a single sheet from a spreadsheet hosted by Google Docs

Example 1: The first argument is a token for authenticating with Google with. This is the token returned by the google_connect() function.

The last argument is how long to cache the results for, expressed in milliseconds.

When used as a Journey expression it returns a value of type Map:

{
"error": null,
"properties": {
"title": "the sheet name"
},
"status": 200,
"values": [
[
"row-1 column-1 value",
"row-1 column-2 value"
],
[
"row-2 column-1 value",
"row-2 column-2 value"
]
]
}
card MyCard do
my_var = google_read_sheet("the-token", "the google sheet-id", "the sheet name", 10_000)
# When used in a piece of text prefix it with an `@`
my_var = "@google_read_sheet(\"the-token\", \"the google sheet-id\", \"the sheet name\", 10_000)"
end

Example 2: When a connection fails, one can inspect the HTTP status and the error to help in decision making on how best to proceed.

When used as a Journey expression it returns a value of type Map:

{
"error": "connection timeout",
"status": null
}
card MyCard do
my_var = google_read_sheet("the-token", "the google sheet-id", "the sheet name", 10_000)
# When used in a piece of text prefix it with an `@`
my_var = "@google_read_sheet(\"the-token\", \"the google sheet-id\", \"the sheet name\", 10_000)"
end

Openai

attachment_url(media_id, ttl)

Return a time-limited URL that gives access to the media referenced by the given id.

Example 1: Return a URL for an attachment received with a limited TTL.

The second parameter is the amount of minutes the URL will be valid for. If not supplied it defaults to 15.

The TTL supplied must be more than or equal to 1 and less than or equal to 10000 which is just under 7 days. If the provided TTL value is less than 1 it will be set to 1. If the provided TTL value is greater than 10000 it will be set to 10000.

When used as a Journey expression it returns a value of type String: "https://example.org/attachment-url".

card MyCard do
my_var = attachment_url(event.message.image.id, 10)
# When used in a piece of text prefix it with an `@`
my_var = "@attachment_url(event.message.image.id, 10)"
end

openai_add_function(connection, name, description, parameters)

Add a function definition to the OpenAI context for the given role.

Example 1: Add a function called make_booking to the OpenAI context

When used as a Journey expression it returns a value of type Map:

{
"__type__": "openai/v1",
"functions": [
{
"function": {
"description": "Make an appointment booking",
"name": "make_booking",
"parameters": {
"properties": {},
"type": "object"
}
},
"type": "function"
}
]
}

when used with the following context:

%{"ai" => %{"__type__" => "openai/v1", "functions" => []}}
card MyCard do
my_var = openai_add_function(ai, "make_booking", "Make an appointment booking", parse_json('{
"type": "object",
"properties": {}
}'))

# When used in a piece of text prefix it with an `@`
my_var = "@openai_add_function(ai, \"make_booking\", \"Make an appointment booking\", parse_json('{
\"type\": \"object\",
\"properties\": {}
}'))
"
end

openai_add_image(connection, role, prompt, image_url)

Add an image to the OpenAI context for the given role, this requires one to setup a connection with a vision capable model.

By default this sets a maximum of 300 tokens.

Example 1: Add an image to the OpenAI context for use with the Vision API.

ai = openai_add_image(ai, "user", question, image_url)
completion = openai_chat_completion(ai)
text("@completion.response")

When used as a Journey expression it returns a value of type Map:

{
"__type__": "openai/v1",
"max_tokens": 300,
"messages": [
{
"content": [
{
"text": "Describe this image",
"type": "text"
},
{
"image_url": {
"url": null
},
"type": "image_url"
}
],
"role": "user"
}
]
}

when used with the following context:

%{"ai" => %{"__type__" => "openai/v1", "messages" => []}}
card MyCard do
my_var = openai_add_image(ai, "user", "Describe this image", attachment_url(event.message.image.id))

# When used in a piece of text prefix it with an `@`
my_var = "@openai_add_image(ai, \"user\", \"Describe this image\", attachment_url(event.message.image.id))
"
end

openai_add_image(connection, role, prompt, image_url, max_tokens)

Add an image to the OpenAI context for the given role, this requires one to setup a connection with a vision capable model.

This allows one to specify a custom amount of tokens.

Example 1: Add an image to the OpenAI context for use with the Vision API.

ai = openai_add_image(ai, "user", question, image_url, 150)
completion = openai_chat_completion(ai)
text("@completion.response")

When used as a Journey expression it returns a value of type Map:

{
"__type__": "openai/v1",
"max_tokens": 150,
"messages": [
{
"content": [
{
"text": "Describe this image",
"type": "text"
},
{
"image_url": {
"url": null
},
"type": "image_url"
}
],
"role": "user"
}
]
}

when used with the following context:

%{"ai" => %{"__type__" => "openai/v1", "max_tokens" => nil, "messages" => []}}
card MyCard do
my_var = openai_add_image(ai, "user", "Describe this image", attachment_url(event.message.image.id), 150)

# When used in a piece of text prefix it with an `@`
my_var = "@openai_add_image(ai, \"user\", \"Describe this image\", attachment_url(event.message.image.id), 150)
"
end

openai_add_message(connection, role, content)

Add a single message to the OpenAI context for the given role.

Example 1: Add a single system prompts to the context

When used as a Journey expression it returns a value of type Map:

{
"__type__": "openai/v1",
"messages": [
{
"content": "you are a friendly AI",
"role": "system"
}
]
}

when used with the following context:

%{"ai" => %{"__type__" => "openai/v1", "messages" => []}}
card MyCard do
my_var = openai_add_message(ai, "system", "you are a friendly AI")
# When used in a piece of text prefix it with an `@`
my_var = "@openai_add_message(ai, \"system\", \"you are a friendly AI\")"
end

openai_add_messages(connection, role, messages)

Add a set of messages to the OpenAI context for the given role.

Example 1: Add a series of system prompts to the context

When used as a Journey expression it returns a value of type Map:

{
"__type__": "openai/v1",
"messages": [
{
"content": "you are a friendly AI",
"role": "system"
},
{
"content": "Answer questions as succinctly as possible",
"role": "system"
}
]
}

when used with the following context:

%{"ai" => %{"__type__" => "openai/v1", "messages" => []}}
card MyCard do
my_var = openai_add_messages(ai, "system", ["you are a friendly AI", "Answer questions as succinctly as possible"])
# When used in a piece of text prefix it with an `@`
my_var = "@openai_add_messages(ai, \"system\", [\"you are a friendly AI\", \"Answer questions as succinctly as possible\"])"
end

openai_connect(token, model)

Set up a connection to OpenAI's APIs with the given token and the model. The returned value is to be used as the connection for all other openai_* functions.

Example 1: Connect to GPT4 with an API token.

When used as a Journey expression it returns a value of type Map:

{
"__type__": "openai/v1",
"functions": [],
"max_tokens": null,
"messages": [],
"model": "gpt-4",
"token": "sk-XXXXX"
}
card MyCard do
my_var = openai_connect("sk-XXXXX", "gpt-4")
# When used in a piece of text prefix it with an `@`
my_var = "@openai_connect(\"sk-XXXXX\", \"gpt-4\")"
end

Ai

ai_add_image(connection, role, prompt, image_url)

Add an image to the AI context for any vendor, this requires a vision-capable model. Works with OpenAI, Anthropic, Gemini, and other vendors.

Example 1: Add an image to the AI context for use with vision-capable models.

ai = ai_add_image(ai, "user", "Describe this image", image_url, 300)
completion = ai_chat_completion(ai)
text("@completion.response")

When used as a Journey expression it returns a value of type Map:

{
"max_tokens": 300,
"messages": [
{
"content": [
{
"text": "What's in this image?",
"type": "text"
},
{
"image_url": {
"url": null
},
"type": "image_url"
}
],
"role": "user"
}
],
"vendor": "anthropic"
}

when used with the following context:

%{"ai" => %{"max_tokens" => nil, "messages" => [], "vendor" => "anthropic"}}
card MyCard do
my_var = ai_add_image(ai, "user", "What's in this image?", attachment_url(event.message.image.id), 300)

# When used in a piece of text prefix it with an `@`
my_var = "@ai_add_image(ai, \"user\", \"What's in this image?\", attachment_url(event.message.image.id), 300)
"
end

ai_add_image(connection, role, prompt, image_url, max_tokens)

Add an image to the AI context with custom max_tokens setting.


Contacts

has_segment_match(contact_arg, segment_uuid_arg)

Checks if a contact is a member of a specific segment.

Queries Elasticsearch to determine if the contact matches the segment's query string. Returns true if the contact is in the segment, false otherwise.

Raises an error if the contact argument is missing or doesn't have a uuid.

Example 1:

When used as a Journey expression it returns a value of type Boolean: true when used with the following context:

%{"contact" => %{"uuid" => "contact-123"}, "number" => %{"uuid" => "number-456"}}
card MyCard do
my_var = has_segment_match(contact, "d58b0319-eb3f-4884-b43b-4ef0b7c37e1d")
# When used in a piece of text prefix it with an `@`
my_var = "@has_segment_match(contact, \"d58b0319-eb3f-4884-b43b-4ef0b7c37e1d\")"
end

Time

monotonic_time()

Returns the current monotonic time in native units.

Monotonic time is guaranteed to always increase and is not affected by system clock adjustments. This makes it ideal for measuring time intervals and computing latencies. Use with time_elapsed() to get duration in milliseconds.

Example 1:

When used as a Journey expression it returns a value of type Integer: 123456789.

card MyCard do
my_var = monotonic_time()
# When used in a piece of text prefix it with an `@`
my_var = "@monotonic_time()"
end

time_elapsed(start_time)

Calculates the elapsed time in milliseconds since a given start time.

Takes a monotonic timestamp (as returned by monotonic_time()) and returns the duration in milliseconds from that timestamp to now.

Example 1:

When used as a Journey expression it returns a value of type Integer: 42 when used with the following context:

%{"start_time" => 123456789}
card MyCard do
my_var = time_elapsed(start_time)
# When used in a piece of text prefix it with an `@`
my_var = "@time_elapsed(start_time)"
end

Uncategorized

__expression_functions()


close_chat(reason)


Contact field accessors

ENUM custom fields: .value and .display

Custom contact fields of type ENUM expose two extra accessors so you don't need to map the raw value to its label by hand. The bare reference stays backwards compatible (it coerces to the stored value), while .value and .display give you explicit access:

AccessorReturns
@contact.fieldthe raw stored value (string coercion, unchanged)
@contact.field.valuethe raw stored value
@contact.field.displaythe option's configured display label
card MyCard do
# @contact.appointment_type -> "IN_PERSON" (raw value)
# @contact.appointment_type.value -> "IN_PERSON"
# @contact.appointment_type.display -> "In person" (configured label)
text("Appointment type: @contact.appointment_type.display")
end

Use .value (or the bare reference) in conditions where you compare against the stored value, and .display in text() where you want the human-readable form.

DATE fields are plain ISO 8601 timestamps — compare them bare and format them for display with @datevalue(...):

card MyCard do
# Compare directly (no accessor needed):
# contact.appointment_at > datetime_add(now(), -12, "h")
text("Your appointment is on @datevalue(\"@contact.appointment_at\", \"%d %b %Y %H:%M\")")
end