Variable types
Every variable has one of four types:| Type | Holds | Example |
|---|---|---|
| String (Text) | Text | "monthly", a name, an email |
| Number | A number | 0, 42, a score |
| Boolean (True/False) | true or false | a toggle, a “has agreed” flag |
| List (Array) | A homogeneous list of items | selected options |
Where a variable’s value comes from
When you create a variable you pick a Variable Type (this is separate from the data type above). It decides where the value comes from and whether the flow can change it.| Variable Type | Source | Editable in the flow? | Use it for |
|---|---|---|---|
| Flow State | A constant initial value you set in the editor | Yes, actions can change it | choices, counters, toggles, anything the flow itself updates |
| App Parameter | A value read from the SDK context at runtime | No, it is read-only | user id, plan, app version, anything the host app knows |
- Flow State is mutable. Its starting value is the Initial Value you type in the dialog. Actions like Set Variable can change it while the flow runs.
- App Parameter is read-only. The SDK supplies its value from the context your app passes in (see Variables and SDK context). The editor derives the lookup path from the variable name (lowercased, with spaces replaced by underscores), so a name like
user.idbecomes a nested path lookup. If the app does not provide a value, the Default Value is used as a fallback.
You do not set “writable” or “lifecycle” by hand. The editor sets them for you: Flow State is writable, App Parameter is read-only, and both are session state.
Create a variable
Open the Variables tab
In the left sidebar, click Variables. The panel lists every variable in the flow with its type and current value.
Name it and pick a type
Enter a Name (for example
selected_plan) and choose a Type. For a List, also choose a List Item Type.Choose Flow State or App Parameter
Set Variable Type to Flow State (a value the flow owns and changes) or App Parameter (a value the app provides through the SDK).
Set the starting value
For Flow State, set the Initial Value. For App Parameter, set a Default Value to fall back to when the app does not provide one.
Keys vs names
When you create a variable from this dialog, the editor stores your typed name as the variable’s label and assigns it a generated key likevar_ab12cd. The key is what {{ }} interpolation and conditions actually use.
You rarely type keys by hand:
- Text fields have a
{}Insert variable button that lists variables by name and splices the correct{{key}}token at your cursor. - The condition builder and the Set Variable action both pick variables from a dropdown that shows names, not raw keys.
selected_* variable) use readable keys instead of generated ones.
Using variables
There are four ways to use a variable:- Interpolate it in text. Anywhere text accepts it,
{{key}}is replaced with the variable’s current value. For example, a heading ofWelcome back, {{first_name}}renders the value offirst_name. Use the{}button to insert the right token. - Drive a dynamic value. Feed a variable into a condition to switch a property’s value. See Dynamic values.
- Change it with an action. The Set Variable action applies a typed operation (set, increment, toggle, add to list, and so on). Only Flow State variables appear in its picker, because App Parameters are read-only.
- Bind it to a component input. A component prop or a custom component input can read from a variable instead of a fixed value.
Example
A simple plan picker:- Create a Flow State String variable named
selected_planwith an Initial Value ofmonthly. - On a “Monthly” button, add a Set Variable action:
selected_plan-> Set to value ->monthly. On a “Yearly” button, set it toyearly. - On a “Continue” button, make the label dynamic: when
selected_planequalsyearly, showContinue with Yearly, otherwiseContinue. See Dynamic values. - Create an App Parameter String variable named
user.id. Use{{user.id}}in a Trigger Event property, or read it on the SDK side for analytics. Your app supplies its value through the SDK context.
selected_plan looks like this:
Common mistakes
- Wrong type. Storing a number as a String breaks numeric comparisons (
greater than,less than) because those operators only work on Number variables. Pick the type that matches how you will use the value. - Referencing a key that does not exist. A missing or misspelled variable in
{{ }}resolves to an empty string, so the text just disappears. Insert variables with the{}button to avoid typos, and remember that a manually created variable’s key isvar_..., not the name you typed. - Expecting an App Parameter to change mid-flow. App Parameters are read each time the flow starts. They do not update on their own while a flow is on screen. The app must supply fresh context (see Variables and SDK context).
- Trying to Set Variable on an App Parameter. Read-only variables do not appear in the Set Variable picker, and a write to one is ignored at runtime.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
{{ }} renders nothing | The key does not exist or is misspelled | Insert the variable with the {} button; check the key in the Variables panel |
| A number comparison never matches | The variable is a String, not a Number | Recreate or edit it as a Number |
| An App Parameter is always its default | The app did not send that key, or the path does not match | Confirm the path matches the SDK context your app sends (iOS) |
| A Set Variable action does nothing | The target is read-only (an App Parameter) | Use a Flow State variable instead |