Expressions are a way to reference data in your workflows. To use an expression, you must wrap an expression context around:

${{ <expression> }}

Expressions are evaluated into values before the start of each action run. Expressions are primarily used within action inputs to reference and manipulate data.

Expression Contexts

Tracecat comes with five expression context types:

PrefixExpression syntaxDescription
ACTIONSACTIONS.<jsonpath>.result.<field>Reference the result of an action
TRIGGERTRIGGER.<jsonpath>Reference data from the webhook
SECRETSSECRETS.<name>.<key>Reference a secret
FNFN.<fn_name>(<arg1>, <arg2>, ...)Call a function
VARSVARS.<jsonpath>Reference fixed workflow variables

We use dot notation and JSONPath to access specific data in a particular context. For example, ACTIONS.my_action.result.data.items selects the items field from a nested JSON object returned by the my_action action.

Actions

Use the ACTIONS prefix to reference the result of an action.

Trigger

Workflows can be triggered via webhook, manual trigger, or the Execute Child Workflow action. Use the TRIGGER prefix to reference the data from the trigger as a JSON object.

${{ TRIGGER.<jsonpath> }}

Secrets

Secrets stored in the secrets manager can be accessed using the SECRETS prefix:

${{ SECRETS.<name>.<key> }}

Functions

Check out the functions cheatsheet for a list of available functions.

Use functions to manipulate data. Functions are called using the FN prefix. For example, the following expression will return the boolean value true:

${{ FN.contains("a", ["a", "b", "c"]) }}

We also support nested function and expression calls.

For example, the following expression will:

  1. First evaluate the expression FN.join(["hello", "world"], " ") as hello world
  2. Then call FN.contains with the arguments hello world and ["hello", "world", "tracecat"]
  3. And finally, return the boolean value true
${{ FN.contains(FN.join(["hello", "world"], " "), ["hello", "world", "tracecat"]) }}

Variables

Variables used to be called “static inputs” with the INPUTS prefix prior to version 0.14.

Variables are accessed using the VARS prefix:

${{ VARS.<jsonpath> }}

Operators

Check out the operators cheatsheet for the full list of supported operators.

We support standard operators (+, -, *, /) for all Pythonobject types (e.g. int, float, str, datetime, timedelta, list, dict).

Typecasting

We also support casting expressions into different data types with the following syntax:

Supported typecasts:

Data TypeBehavior
intPython int
floatPython float
strPython str
datetimeCustom datetime - parses ISO 8601 datetime strings
boolCustom bool - true for any truthy value, 1, or upper/lower case true