Custom variables
Define your own variables inside a journey to collect, store, transform, and branch on data as users move through the flow.
Custom variables let you carry data through a journey. A variable might hold a user's shoe size, a coupon code, the result of an API call, or a simple true/false flag — anything you need to remember between steps.
Variables are scoped to a single journey. Each user who enters the journey gets their own copy of every variable, initialized to the default value you set when you created it. As the user moves through the flow, Set Variable actions can overwrite that value, and Condition nodes can branch on it.
Creating a variable
Open the journey in the flow builder and click the Brand Safety & Variables button in the top bar. Switch to the Variables tab.
Each variable needs:
| Field | What it means |
|---|---|
| Name | Up to 18 characters. This is how you'll reference it everywhere — in messages, conditions, and Set Variable nodes. Displayed as @variableName in the builder. |
| Default value | The starting value for every user who enters the journey. Can be empty. |
| Data type | Determines what operators are available in conditions and how the value is stored. See below. |
Data types
| Type | UI label | Example default value |
|---|---|---|
| Text | TEXT | hello |
| Number | NUMBER | 0 |
| Boolean | YES / NO | YES or NO |
| JSON | JSON | {"size": "M"} |
You can edit or delete a variable at any time from the same panel. Deleting a variable that's referenced by a node won't break the journey definition, but the node will stop resolving a value at runtime.
Setting a variable mid-journey
Drop a Set Variable node onto the canvas (it's under Internal Actions → Set Variable in the sidebar). The node lets you pick which variable to write to and how to resolve the new value.
Static value
Type a literal value. At runtime the variable is set to exactly what you typed.
From another variable or system field
Reference another variable or a built-in field using the @mention syntax in the value input. Under the hood, Scrollmark replaces these at runtime with the resolved value. For example, setting a variable's value to @Instagram Username would resolve to the engaging user's Instagram handle.
For JSON variables, you can read a nested key with dot-path syntax:
@apiResponse::data.0.nameThis walks into the JSON stored in apiResponse, takes the first element of the data array, and pulls out the name field.
AI-generated value (Mark)
Toggle the Mark option to let Scrollmark's AI resolve the value. You provide natural-language instructions (e.g., "Determine the user's T-shirt size from the conversation so far"), and Mark writes the value at runtime based on the conversation context. The instructions field supports the same @mention references as regular messages.
Reading a variable in messages
Inside any Send a DM or Reply to Comment node, type @ in the message editor to see your custom variables alongside the built-in fields (username, email, etc.). When the message is sent, Scrollmark substitutes the variable's current value into the text.
If the variable has not been set yet for that user, the default value is used. If there is no default value, the placeholder is replaced with an empty string.
Branching on a variable
Add a Condition node and choose Compare Variable. You'll pick:
- Variable — which custom variable to evaluate.
- Operator — depends on the data type:
- Text: begins with, equals, not equals, contains, does not contain
- Number: equals, not equals, greater than, less than, greater than or equal, less than or equal
- Boolean: is true, is false
- JSON: compared as text after serialization
- Value — the constant to compare against.
The condition produces a true/false branch, just like every other condition node.
Persisting data beyond the journey
Variables only live for the duration of a single journey run. If you need data to survive across journeys — or to show up on the user's Audience profile — use the Store Fields to User Profile internal action. It writes one or more resolved values (variables, system fields, or a mix) into the user's profile record, where they're visible in the Audience tab and available to future journeys.
Tips
- Name variables clearly. You'll reference them in messages, conditions, and Set Variable nodes. Short, descriptive names (
shoeSize,couponCode,hasOptedIn) save time later. - Set defaults defensively. If a condition might run before a Set Variable node, make sure the default value produces a sensible branch.
- Use JSON for structured data. When an API webhook returns a complex payload, store it in a JSON variable and use dot-path access to pull out the fields you need downstream.
- One variable, many writes. A variable can be overwritten multiple times in a single journey run. Each Set Variable node creates a new snapshot, and the most recent value wins.
Related pages
- Journeys — how to build and publish the flows that use variables
- Triggers and actions — the full list of nodes, including Set Variable and Compare Variable