Variables let you pull dynamic information into your flows, but knowing how to actually use them is key. This guide walks you through inserting variables, building conditional logic, creating custom workflow variables, and solving common problems.
1. How to Insert a Variable Into a Message
Variables can be inserted into any text field in your flow, whether it's a message, button label, or action field.
Steps:
Add a message block (like "Send Message") to your flow.
Click on the text input field where you want to add a variable.
A dropdown menu will appear showing all available variables organized by category:
User Attributes
Store Attributes
Workflow Variables
Custom Contact Fields
Trigger Attributes
Last Order Details
Click on the variable you want to use, and it will be inserted into your message.
Example:
Message:
Hey {{contact.firstName}}, your order #{{trigger.name}} is on its way!
What the customer sees:
Hey Sarah, your order #1234 is on its way!
Pro Tip:
You can mix multiple variables in a single message. Just click the text field again to add more. Just make sure to not remove the curly braces on both ends. Also ensure that you don't stack 2 variables next to each other. If you are going to do that, at least have a space between the two variables.
2. How to Use Variables in Conditions (If/Then Logic)
Variables aren't just for messages. You can use them to build smart conditional logic that makes decisions based on real data.
Steps:
Add a Condition block to your flow.
In the condition settings, click on the value field where you want to compare data.
Select a variable from the dropdown (like {{trigger.total_price}} or {{contact.tags}}).
Set your comparison operator (is, is not, greater than, less than, equals, contains, is empty, is not empty, has any value, is an email string, is url string, is date etc.).
Add the value you want to compare against.
Example 1: Send a Thank You Message for Large Orders
Condition:
If {{trigger.total_price}} > 10000
Then Send Message:
Wow, {{contact.firstName}}! Thanks for your huge order of βΉ{{trigger.order_total}}. You're a legend! π
Else:
Thanks for your order, {{contact.firstName}}! We appreciate your support.
Example 2: Tag-Based Routing
Condition:
If {{contact.tags}} contains "VIP"
Then:
Route to VIP support agent
Else:
Send standard automated response
Example 3: Check Payment Status
Condition:
If {{{trigger.financial_status}} equals "paid"
Then:
Send order confirmation message
Else:
Send payment reminder
3. How to Save a Variable as a Workflow Variable
Workflow variables let you store information collected during a flow so you can reference it later.
Steps:
Add a "Text With User Input" block to ask the customer a question.
In the block settings, find the "Save To" section.
Check the box that says "Show in Flow Data".
Give your variable a name (e.g., Customer's name, Preferred delivery date, Feedback rating).
Save the flow.
Once saved, the variable becomes available throughout the rest of the flow under Workflow Variables.
Example:
Send Message #0:
What's your name?
Wait for customer response β Save as "Customer's name", you can reference it as {{properties['Customer's name']}}
β
Send Message #1:
Nice to meet you, {{properties['Customer's name']}}!
How can we help you today?
What the customer sees:
Nice to meet you, John! How can we help you today?
You Can Also Save Values Using Actions
You don't have to wait for customer input. You can use the "Save in Flow Column" action to store any value.
Example:
Action: Save in Flow Column
Column: name provided?
Data: yes
Now you can reference {{properties['name provided?]'}} later in the flow at any point.
4. Common Use Cases for Variables
Use Case 1: Personalized Abandoned Cart Recovery
Trigger: Checkout Started
Delay: 30 minutes
Exit condition: Order Placed (this ensures that we are only targeting people who haven't placed an order even after 30 minutes of them starting the checkout.)
Message:
Hey {{contact.firstName}},
You left {{trigger.computed.product_names}} in your cart.
Complete your order and save 10%: {{trigger.abandoned_checkout_url}}
Use Case 2: Dynamic Order Confirmation
Trigger: Order Created
Message:
Thanks for your order, {{contact.firstName}}!
Your order #{{trigger.name}} totaling βΉ{{trigger.total_price}} is confirmed.
Track it here: {{trigger.order_status_url}}
Use Case 3: Feedback Collection with Follow-Up
Send Message #0:
How would you rate your experience with us? Reply with a number from 1 to 10.
Wait for response β Save as rating and reference as {{properties['rating']}}
Condition:
If {{properties['rating']}} > 7
Then:
Thanks for the {{properties['rating']}} rating! We're thrilled you loved it. π
Else:
Thanks for the {{properties['rating']}} rating.
We'd love to hear how we can improve. Can you share more?
FAQ & Troubleshooting
Q: Why don't I see certain variables?
A: Variables appear based on context. Here's what might be happening:
Trigger Attributes only appear after you save the flow. If you just selected a trigger, save the flow first, then check again.
Workflow Variables only appear after you create and save them. If you haven't set up a "Save To" action yet, they won't show up.
Custom Contact Fields only appear if you've created them in the Database section.
Some variables are channel-specific. For example, Last Order Details variables only work in WhatsApp flows, not Instagram or Facebook.
Q: What happens if a variable has no value?
A: If a variable is empty (for example, the customer hasn't provided their email), the variable will return nothing.
What this means:
In messages, the variable will appear as blank space.
In conditions, the comparison may fail or behave unexpectedly.
The message may fail to send entirely if the variable is required.
How to prevent this:
Use conditional logic to check if a variable exists before using it.
Set default values or fallback messages in your flow.
Example:
Condition:
If {{contact.firstName}} is not empty
Then:
Hey {{contact.firstName}}, thanks for reaching out!
Else:
Hey there, thanks for reaching out!
Alternatively you can also use fallbacks with the variables too. Read more about that here.
Q: Can I create my own custom variables?
A: Yes! You can create custom variables in two ways:
Workflow Variables: Save customer responses or any data during a flow using the "Text With User Input" block or "Save in Flow Column" action.
Custom Contact Fields: Go to the Database section in Spur and create custom fields like "Birthday Month," "VIN," or "Preferred delivery time." Once created, these fields become available as variables in all flows.
Q: Can I use variables in button labels?
A: Yes! You can insert variables into button text, URLs, and any other text field in your flow.
Example:
Button Label: Track Order #{{trigger.name}}
Button URL: {{trigger.order_status_url}}
Q: What's the difference between Trigger Attributes (when Order created trigger is used) and Last Order Details?
A: Both contain order data, but they work differently:
Trigger Attributes with order data to reference are only available when a specific trigger (like "Order Created") fires. They contain data from that specific event.
Last Order Details are always available (in WhatsApp flows only) and contain data from the customer's most recent order, regardless of which trigger you're using.
Warning: Only use Last Order Details variables when you're certain the customer has placed at least one order. Otherwise, the variables will be empty and the flow will fail.
Q: Why can't I use Instagram variables like {{contact.username}} in my flow?
A: Due to Instagram's API limitations, certain user data (like username, follower count, and verification status) can't be fetched until the user has sent at least one message to your account.
Solution: Use these variables only after the user has messaged you, not in automated comment replies or in your first message to them
Best Practices for Using Variables
Always test your flows before going live to make sure variables are pulling the correct data.
Use conditional logic to handle cases where variables might be empty.
Keep variable names simple (especially for workflow variables) to avoid syntax issues.
Don't overload messages with too many variables. Keep it natural and readable.
Use Last Order Details variables carefully. Only use them when you're sure the customer has ordered before.

