Functions

Text 

FunctionSummary
APPEND

Joins two pieces of text together.

CAPITALIZE

Makes the first character of text uppercase and converts the remaining characters to lowercase.

DEFAULT

Allows you to specify a fallback in case a value doesn’t exist.

DOWNCASE

Makes each character in text lowercase.

ESCAPE

Escapes text by replacing characters with escape sequences (e.g. so that the text can be used in a URL)

ESCAPE_ONCE

Escapes text without changing existing escaped entities.

FORCE_ARRAY

If the supplied argument is an array it returns it, otherwise wraps it in an array

HTML_DECODE

Converts escaped characters in text to HTML syntax characters, e.g. &lt;élan&gt; becomes <élan>.

HTML_ENCODE

Escapes HTML syntax characters in text, e.g. <élan> becomes &lt;élan&gt;.

INCLUDES

Returns TRUE if target (which can be text, an object or an array) includes value, otherwise returns FALSE.

IS_BLANK

Returns true if a value is falsy ie. FALSE, "", [], {}, NULL, and false otherwise

IS_EMPTY

Returns true if a value is empty ie. "", [], {} and false otherwise

LSTRIP

Removes all whitespace (tabs, spaces, and newlines) from the beginning of text.

MATCH

Returns true if text contains the regex expression regex_to_match and false otherwise.

NEWLINE_TO_BR

Replaces every newline (\n) with an HTML line break (<br>).

PLURALIZE

Outputs the singular or plural version of text based on the value of a number.

PREPEND

Adds the specified text to the beginning of the other text.

REGEX_EXTRACT

Returns an array of all the regex matches on the input text.

REGEX_REPLACE

Replaces every occurrence of a regex match in text with the second argument.

REMOVE

Removes every occurrence of the specified sub-text from text.

REMOVE_FIRST

Removes the first occurrence of the specified sub-text from text.

REPLACE

Replaces every occurrence of the search text with the replacement text.

REPLACE_FIRST

Replaces the first occurrence of the search text with the replacement text.

RSTRIP

Removes all whitespace (tabs, spaces, and newlines) from the right side of text.

SIZE

Returns the number of characters in text or the number of elements in an array.

SLICE

Returns 1 or length characters from a piece of text, beginning at the start_index.

SPLIT

Divides the input text into an array using the delimiter as a separator

STRIP

Removes all whitespace (tabs, spaces, and newlines) from both the left and right side of text.

STRIP_HTML

Removes any HTML tags from text.

STRIP_NEWLINES

Removes any newline characters (line breaks) from text.

TEXT

Converts the passed value to text.

TO_SNAKE_CASE

Turn input text into snake case.

TRANSLITERATE

Replaces non-ASCII characters with an ASCII approximation, or if none exists, a replacement character: “?”.

TRUNCATE

Shorten text down to the number of characters passed as a parameter.

TRUNCATEWORDS

Shortens text down to the number of words passed as the argument.

UPCASE

Makes each character in text uppercase.

URL_DECODE

Decodes text that has been encoded as a URL or by URL_ENCODE.

URL_ENCODE

Converts any URL-unsafe characters in the given text into percent-encoded characters.

UUID

Generates a universally unique identifier (UUID)

TRUE/FALSE 

FunctionSummary
AND

Returns TRUE if all arguments are truthy, otherwise returns FALSE.

DEFAULT

Allows you to specify a fallback in case a value doesn’t exist.

IF

If condition is TRUE returns second argument, if FALSE returns null or the third argument.

IS_BLANK

Returns true if a value is falsy ie. FALSE, "", [], {}, NULL, and false otherwise

NOT

Returns the logical opposite of the supplied param.

OR

Returns true if any of the arguments are truthy, otherwise returns false.

Numbers 

FunctionSummary
ABS

Returns the absolute value of a number.

AT_LEAST

Limits a number to a minimum value.

AT_MOST

Limits a number to a maximum value.

CEIL

Rounds the input up to the nearest whole number.

DIVIDED_BY

Divides a number by the specified number.

FLOOR

Rounds a number down to the nearest whole number.

IS_BLANK

Returns true if a value is falsy ie. FALSE, "", [], {}, NULL, and false otherwise

MAX

Returns the argument with the highest numeric value.

MIN

Returns the argument with the lowest numeric value.

MINUS

Subtracts a number from another number.

MODULO

Returns the remainder of a division operation.

NUMBER

Converts the passed value to a number.

PLUS

Adds a number to another number.

RANDOM

Returns a random number in the range specified.

ROUND

Rounds an input number to the nearest whole number or, if precision is specified, to that number of decimal places.

SUM

Sums the elements in an array of numbers.

TIMES

Multiplies a number by another number.

Arrays 

FunctionSummary
ARRAY

Returns an Array with each of the arguments as a member.

CHUNK_ARRAY

Chunks an array into arrays with chunk_size elements. The last chunk may contain less than chunk_size elements.

COMPACT

Removes any null values from an array.

CONCAT

Concatenates (joins together) two arrays.

COUNTIF

Returns the count of all elements in an array that are equal to the comparison argument.

DEFAULT

Allows you to specify a fallback in case a value doesn’t exist.

FILTER

Returns all element in the array for which the lambda returns true.

FIND

Returns the first element in the array for which the lambda returns true.

FIRST

Returns the first element of an array.

FLATTEN

Turn nested arrays into a single 1 dimensional array

INCLUDES

Returns TRUE if target (which can be text, an object or an array) includes value, otherwise returns FALSE.

IS_BLANK

Returns true if a value is falsy ie. FALSE, "", [], {}, NULL, and false otherwise

IS_EMPTY

Returns true if a value is empty ie. "", [], {} and false otherwise

JOIN

Combines the elements in an array into a single text value using the argument as a separator.

LAST

Returns the last element of an array.

MAP

Creates an array by extracting the values of a named property from an array of objects.

RANDOM_ELEMENT

Select a random element from an array.

RANGE

Returns an array of numbers with the first value equal to start and the last value equal to end.

REJECT

Returns an array or object containing the items for which the given lambda is not true or are not contained within the values_to_remove array.

REVERSE

Reverses the order of the elements in an array.

SHUFFLE

Shuffles all the elements in an array

SIZE

Returns the number of characters in text or the number of elements in an array.

SLICE_ARRAY

Returns the remainder of the array (or length elements of the array, if specified), beginning at the start_index.

SORT

Sorts elements in an array by a property of an element in the array (case-sensitive).

SORT_NATURAL

Sorts elements in an array by a property of an element in the array (case-insensitive).

SUM

Sums the elements in an array of numbers.

UNIQ

Removes any duplicate elements in an array.

WHERE

Selects all the elements in an array where the key has the given value.

Objects 

FunctionSummary
DEEP_MERGE

Creates a new object by recursively merging two or more objects together. Where there are key collisions that last value is used.

FLATTEN_JSON

Flattens nested JSON into a new object with a single layer of key/value pairs. Default key separator is a period or full stop (.)

GET

Get the value in object at the specified path.

INCLUDES

Returns TRUE if target (which can be text, an object or an array) includes value, otherwise returns FALSE.

IS_BLANK

Returns true if a value is falsy ie. FALSE, "", [], {}, NULL, and false otherwise

IS_EMPTY

Returns true if a value is empty ie. "", [], {} and false otherwise

JSONPATH

Evaluates complex JSONPaths.

KEYS

Returns an array of keys present in the object.

MERGE

Creates a new object by merging two or more objects together.

OBJECT

Returns an object with keys and values as specified.

REMOVE_KEY

Removes the specified key from an object. Path is a dot separated path to the object, you can escape dots using backslash

UNFLATTEN_JSON

Transforms a single layer of key/value pairs into a nested JSON structure. Default key separator is a period or full stop (.)

Text/Arrays/Objects 

FunctionSummary

Dates/Times 

FunctionSummary
DATE

Converts a timestamp into another date format.

UNIX_TIMESTAMP

Returns the current unix timestamp, i.e. the number of seconds since midnight on 1 January 1970

All data 

FunctionSummary

Hashing/Signing 

FunctionSummary
AES_DECRYPT

Decrypts text using AES-256-CBC

AES_ENCRYPT

Encrypts text using AES-256-CBC

HMAC_SHA1

Converts text into a SHA-1 hash using a hash message authentication code (HMAC).

HMAC_SHA1_BASE64

Converts text into a Base64 encoded SHA-1 hash using a hash message authentication code (HMAC).

HMAC_SHA256

Converts text into a SHA-256 hash using a hash message authentication code (HMAC).

HMAC_SHA256_BASE64

Converts text into a Base64 encoded SHA-256 hash using a hash message authentication code (HMAC).

JWT_SIGN

Creates a JSON Web Token from the input claim set using either RS256 (default), HS256 or ES256.

MD5

Calculates the hex encoded MD5 hash of some text.

MD5_BASE64

Calculates the Base64 encoded MD5 hash of text.

SHA1

Calculates the sha1 hash of text.

SHA256

Calculates the sha256 hash of text, expressed in hex.

SHA256_BASE64

Calculates the sha256 hash of the text, expressed in base64.

SHA512

Calculates the sha512 hash of text.

Data Parsing/Conversion 

FunctionSummary
BASE64URL_DECODE

Decode URL-safe Base64 encoded text.

BASE64URL_ENCODE

Encode text to URL-safe Base64 encoded text.

BASE64_DECODE

Decode Base64 encoded text.

BASE64_ENCODE

Encode text using the Base64 encoding algorithm.

CSV_PARSE

Parses CSV-formatted text with auto-detection of the delimiter character and parses output into an array of arrays.

CSV_PARSE_TO_OBJECTS

Parses CSV-formatted text with auto-detection of the delimiter character and parses output into an array of objects.

EML_PARSE

Takes text containing EML (RFC822) content and parses out information such as to, from, subject, attachments, etc.

JSON_PARSE

Parses escaped JSON text. If used in conjunction with Single Value Mode, it will return a JSON object, otherwise it will return unescaped JSON text.

LDIF_PARSE

Parse text from a LDAP Data Interchange Format (LDIF) file into an object

MSG_PARSE

Takes the contents of an .msg file (Outlook item/email) and parses out information such as to, from, subject, attachments, etc.

NEAT_JSON

Formats and "pretty prints" an object in JSON.

PARSE_URL

Returns an object that representing the parsed url

TO_CSV

Convert an array into CSV-formatted text.

TO_JSON

Convert an object into JSON text.

UNZIP

Extracts files from a ZIP archive.

VALUES

Returns all the values of an object.

XML_PARSE

Takes text containing XML and parses to an object

ZIP

Creates a ZIP archive containing a given file.

IP Addresses 

FunctionSummary
IN_CIDR

Checks if an IP address is in a given CIDR block.

IS_IP_ADDRESS

Checks if a text value is a valid IP address

Lambdas 

FunctionSummary
COUNTIF

Returns the count of all elements in an array that are equal to the comparison argument.

FILTER

Returns all element in the array for which the lambda returns true.

FIND

Returns the first element in the array for which the lambda returns true.

LAMBDA

Creates a custom, reusable function.

MAP_LAMBDA

Return an array that is the result of calling lambda with each element of the input array.

REDUCE

Allows for turning an array into a single value.

REJECT

Returns an array or object containing the items for which the given lambda is not true or are not contained within the values_to_remove array.

Story Metadata 

FunctionSummary
PROMPT

Emit a URL that when visited will cause the current action to emit a new event. Text is optional, if provided will be available in the status field of the emitted event.

STORY_RUN_GUID

Returns the GUID of the currently executing story run.

STORY_RUN_LINK

Returns a link to the currently executing story run.

Other 

FunctionSummary
TYPE

Outputs the type (class) of the specified value.

Was this helpful?