Expressions
Reference action results and workflow metadata in your workflows
Expressions are a way to reference data in your workflows. To use an expression, you must wrap an expression context around:
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:
Prefix | Expression syntax | Description |
---|---|---|
ACTIONS | ACTIONS.<jsonpath>.result.<field> | Reference the result of an action |
TRIGGER | TRIGGER.<jsonpath> | Reference data from the webhook |
SECRETS | SECRETS.<name>.<key> | Reference a secret |
FN | FN.<fn_name>(<arg1>, <arg2>, ...) | Call a function |
VARS | VARS.<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.
Secrets
Secrets stored in the secrets manager can be accessed using the SECRETS
prefix:
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
:
We also support nested function and expression calls.
For example, the following expression will:
- First evaluate the expression
FN.join(["hello", "world"], " ")
ashello world
- Then call
FN.contains
with the argumentshello world
and["hello", "world", "tracecat"]
- And finally, return the boolean value
true
Variables
Variables used to be called “static inputs” with the INPUTS
prefix prior to version 0.14.
Variables are accessed using the VARS
prefix:
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 Type | Behavior |
---|---|
int | Python int |
float | Python float |
str | Python str |
datetime | Custom datetime - parses ISO 8601 datetime strings |
bool | Custom bool - true for any truthy value, 1 , or upper/lower case true |