Skip to main content

Variables

note

This functionality is only available on paid plans. Check our plans here.

Variables allow you specify values to reuse across all your rules, without having to repeat that value multiple times, making your rules cleaner and quicker to modify. You can access the variables panel from the tweak toolbar.

variables table user interface

To reference a variable use the following syntax:

$tweak.var.<VARIABLE_NAME>

Let's for example use the above specified variable to interpolate it with some JSON:

{
"token": "$tweak.var.custom_token"
}

Variables can be accessed from the top toolbar, and they offer you a simple table where you can specify a variable name and its value. Variables can be referenced across all editors:

info

Only alphanumerical and _ (underscore) are considered valid characters for the variable name.

Types

It's possible to have numerical or boolean values in a given JSON payload. Let's say you want to have a numerical variable timestamp, and its value is 123. When interpolating the variable simply remove the double quotes around the $tweak expression:

{
"name" "John Doe",
"timestamp": $tweak.var.timestamp
}

The JSON editor will throw syntax errors, but that's ok, you can still proceed and tweak will render the JSON with the numerical value.



Was this page helpful?