Reference: liquid helpers
This is a reference of common Knock variables, Liquid syntax, and Knock-specific liquid helpers that you can use within the Knock template editor.
When you build workflows in Knock, we auto-generate certain pieces of state (as a result of batch functions and other workflow steps) that you can use to control the copy you display to your end users in your notification templates.
|User or Object schema properties of the actor that triggered the workflow (may be |
|A list of up to 10 of the unique actors included within the batch, where each actor is a user or object with the properties available on your Knock schema (may be empty).|
|User schema properties of the actor that triggered the workflow.|
|A list of the activity objects included within the batch, where each activity equals the state sent across in your notify call, and also includes the actor who performed the message and a timestamp of when the activity occurred.|
|Account and environment specific variables.|
|The count of activities associated with a workflow run.|
|The count of unique actors associated with a workflow run.|
|The time in which the activity occurred, as an ISO-8601 datetime string.|
|The id, key, and categories of the current workflow.|
The Knock template editor uses Liquid syntax for control flow and variable declaration. Here are a few of the most common Liquid keywords our customers use within Knock. For a complete reference guide we recommend the excellent Liquid documentation.
|Denotes rendering output of an object or variable.|
|Denotes logic and control flow.|
|Creates a switch statement to execute a particular block of code when a variable has a specified value.|
|Add additional conditions to a tag.|
|Repeatedly executes a block of code.|
|Creates a new named variable.|
|Captures the string inside of the opening and closing tags and assigns it to a variable.|
|Takes an ISO 8601 timestamp and returns it in the IANA tz database timezone provided.|
|Takes an integer and formats it to the local number format of the |
|Takes an integer and returns a USD formatted value with two decimal points. You can pass a currency type and a |
|Takes an integer and returns a USD formatted value rounded to nearest whole number. You can pass a currency type and a |
|Takes a value and returns as a formatted JSON string.|
|Takes an integer and a pluralize helper with two strings. If the integer is one, the helper returns the first string. If the helper is greater than one, it returns the second string.|
|Takes a string and reformats it into Title case.|
|Takes a string and returns an md5 hash.|
|Takes a string and returns an sha256 hash.|
|Takes a string and returns an hmac hash given a key provided to hmac_sha256 helper.|
A few of Knock's Liquid helpers (such as
format_number) take an optional locale parameter to format the output of the helper into a localized format. You can find a list of supported locales below. If we're missing a locale that you'd like us to support, please reach out.