Docs/Macros & Variables
#

Macros & Variables

Macros generate fresh, unique data every time a workflow runs. Variables let you reference shared values across nodes. Both use the $ prefix.

Available macros

MacroDescriptionExample
$EMAIL()Unique test emailtest-a1b2@example-test.com
$FIRST_NAME()Random first nameJordan
$LAST_NAME()Random last nameChen
$PHONE()Random US phone+1-555-382-7491
$UUID()Random UUID v4a1b2c3d4-e5f6-...
$NOW()ISO 8601 timestamp2026-02-19T14:30:00.000Z
$NOW(+5m)Shifted ISO timestamp$NOW(-2h), $NOW(30s), $NOW(1d)
$NOW(+5m, "fmt")Shifted time, UTC fmt$NOW(+5m, "m H * * *") = 35 14 * * *
$TODAY()Current date2026-02-19
$DATE(N)Date offset by N days$DATE(7) = next week
$TIMESTAMP()Unix timestamp (ms)1771520400000
$RANDOM_INT(min,max)Random integer$RANDOM_INT(1,100) = 42
$PICK(a,b,c)One listed value, chosen at random$PICK(212,312,415) = 312
$RANDOM_STRING(len)Random alphanumeric$RANDOM_STRING(6) = xK9mQ4
$SEQUENCE(name)Auto-incrementing$SEQUENCE(order) = 1, 2, 3...

$PICK values

$PICK(a,b,c) returns one of the listed literals, each equally likely. Use it when a value must come from a known-good set, such as a real area code for a test phone number. Whitespace around each value is trimmed. Values are literal text: they cannot contain commas or parentheses, and quotes are kept as written. A single value returns that value; an empty list or an empty value ($PICK(), $PICK(a,,b)) is an error.

text
Phone:  ($PICK(212,312,415,617)) 555-0142
Plan:   $PICK(basic, pro, team)

$NOW formats

The optional second argument renders the time in UTC. Tokens: YYYY MM DD HH mm ss (zero-padded) and H m (unpadded hour and minute); everything else is literal, except that a bare H or m is always a token (there is no escape). Use $NOW(, "fmt") to format the current time with no shift. A format cannot contain commas or parentheses. Quote it with single or double quotes (or not at all); inside a JSON string such as an API sequence bodyTemplate use single quotes.

text
$NOW(, "YYYY-MM-DD HH:mm")     2026-02-19 14:30
$NOW(+5m, "m H * * *")         daily cron that first fires in ~5 minutes

Syntax

Macros follow the format $MACRO_NAME() or $MACRO_NAME(args). They can appear standalone or inline within a larger string:

text
Standalone:  $EMAIL()
Inline:      user-$UUID()@corp.com
Escaped:     \$EMAIL() produces the literal text $EMAIL()

Each run resolves macros independently — every execution gets fresh values.

Variables

Variables reference values set during a workflow run. When an action has input fields or extracts data, those become $var.{name} references.

Sources:

SourceDescriptionExample
InputA value entered in an action's field$var.company
MacroA macro expression in a field$var.email
ExtractedData extracted from the page$var.order_id
CredentialValues from the login credential$var.username

Use $var.{name} in subsequent step formFields and descriptions. Don't re-hardcode values — reference the variable from the earlier step.

How variables get bound

Three distinct paths create $var.{name} bindings. Picking the wrong one is a common foot-gun.

1. Typed input (auto-promote)

Add an entry to inputValues on an action node:

text
inputValues: { company: "$RANDOM_STRING(8)" }

The key "company" auto-promotes to $var.company for every downstream node. Do NOT also list it in declaredOutputs — the input itself IS the binding.

2. DOM capture (declaredOutputs + playbook capture)

For values that only exist after the page renders (URL fragment, badge text, generated ID in the breadcrumb), declare them upfront and capture them inside the playbook:

text
declaredOutputs: ["order_id"]
playbookSteps: [
  { order: N, action: "capture", target: "<selector or rule>",
    outputKey: "order_id" }
]

The capture step writes into $var.order_id at runtime. Without declaredOutputs the downstream resolver won't recognize the binding.

Rule of thumb: if you can type the value into a field before the run, it's an input. If the value only exists after something happens in the browser, it's a captured output.

3. Received SMS text (declaredOutputs + sms_messages saveAs)

Text from an SMS the run received (an invitation text, a reply notice) is not on the page, so never capture it with browser_evaluate: the agent would have to retype it, and retyped text gets truncated, reflowed or joined across lines. Declare the output, set alwaysUseAgent: true on that action node (a cached replay cannot read a new message), and tell the action to save it with the SMS tool, which copies the stored text on the server:

text
alwaysUseAgent: true
declaredOutputs: ["invite_text"]
actionDescription: "Use sms_messages to find the newest text with the
  invitation link, then call sms_messages get with that message id and
  saveAs invite_text."
  • saveAs alone saves the whole body exactly as received, line breaks and spacing included.
  • Add after and/or before (exact substrings, not regular expressions) to save part of it: the text after the first after and before the next before. For one line: "after": "To get started, ", "before": "\n" (a JSON newline).
  • Without alwaysUseAgent: true, saveAs returns an error and saves nothing. Keep the SMS read in its own action node so the rest of the journey still caches.
  • Do not ask for "the first 40 words" or "a single line": check the saved value with a condition node instead (contains, matches, or a matches pattern that allows \s+ where the message wraps).

Seed variables

When seed workflows are configured, their outputs are available as $var.{dataKey} references. If a seed provides data you need (a project ID, a user record), use the seed variable — don't create that data again.

Common patterns

Unique user registration:

text
Email: $EMAIL()
Name: $FIRST_NAME() $LAST_NAME()

Numbered items:

text
$SEQUENCE("orders") → 1, 2, 3... (resets each run, independent per name)

Date-relative testing:

text
$DATE(30) for 30 days out, $DATE(-7) for last week, $TODAY() for now

Unique identifiers:

text
$UUID() for globally unique, $RANDOM_STRING(8) for shorter strings
Combine with text: order-$RANDOM_STRING(6)

Best practices

  • Use $EMAIL() instead of hardcoded addresses for uniqueness
  • Use $SEQUENCE("name") when you need predictable ordering within a run
  • Prefer $DATE(days) over fixed dates so tests stay valid over time
  • Always include a value for every formField — don't leave fields empty