Variable Syntax
Anywhere in a task (URL, Selectors, Action Values, Scripts), you can reference a variable using the{$varName} syntax.
Example:
- Variable:
query= “Figranium” - Action: Type into
input[name="q"] - Value:
{$query}
{$query} with “Figranium”.
Defining Variables
- Task Variables: Define default values in the Editor > Variables section.
- Types: String, Number, Boolean.
- Runtime Variables: Pass overrides via the API when triggering a task.
POST /api/tasks/:id/apibody:{"variables": {"query": "new value"}}
Special Variables
Figranium provides several built-in variables:{$now}: Current ISO timestamp.block.output: The result of the previous action (e.g., text from ajavascriptblock).loop.index: The current index in aforeachloop.loop.item: The current item in aforeachloop.loop.text: The text content of the current loop item.loop.html: The HTML content of the current loop item.
Dynamic Usage
You can use variables to build complex logic:- URL Templating:
https://example.com/search?q={$query} - Selectors:
.item[data-id="{$itemId}"] - Scripts:
const user = "{$username}";
Persistent Variables
Theset action allows you to update variables during execution.
- Action:
set - Var Name:
counter - Value:
{$counter} + 1(JavaScript expression)