
Configuration Options
Variable Selection
- Variable Dropdown: Choose from existing variables or create new ones
- Variable Creation: Automatically creates variables that don’t exist
- Variable Scope: Control whether variables are session-only or saved to results
- Type Safety: Ensures proper variable type handling throughout the flow
Value Type Selection
The Set Variable block offers 18 different ways to set variable values:Static Values
- Custom: Set any text value or JavaScript expression
- Empty: Reset variable to undefined state
- Random ID: Generate unique identifier using CUID algorithm
User Data (WhatsApp only)
- Phone Number: User’s WhatsApp phone number
- Contact Name: User’s WhatsApp display name
Date and Time
- Now: Current date and time in ISO format
- Today: Current date without time
- Yesterday: Previous day’s date
- Tomorrow: Next day’s date
- Moment of the Day: Time-based greeting (morning/afternoon/evening/night)
System Values
- Environment Name: Platform identifier (web/whatsapp)
- Result ID: Current conversation result identifier
- User ID: Unique user identifier for the session
- Transcript: Complete conversation history
Data Manipulation
- Append Value(s): Add values to arrays or create arrays
- Pop: Remove and store last item from array
- Shift: Remove and store first item from array
- Map Item with Same Index: Cross-reference between related arrays
Advanced Configuration
- Save in Results: Persist variables beyond the session
- Execute on Client: Run JavaScript code in user’s browser
- Time Zone Support: Convert dates to specific time zones
Custom
You can set your variable with any value withCustom
. It can be any kind of plain text but also
Javascript code.
Expressions with existing variables
It means you can apply operations on existing variables. Add a value to your variable:return
keyword then it will be automatically prepended to the beginning
of your code.
Variables in script are not parsed, they are evaluated. So it should be treated as if it were real Javascript variables.So, if you write
"{{My variable}}"
, it will parse the variable ID (something like
vclfqgqkdf000008mh3r6xakty
). You need to remove the double quotes to properly get the variable
content value.For example,- ❌
"{{URL base}}/path"
=>vclfqgqkdf000008mh3r6xakty/path
- ✅
{{URL base}} + '/path'
=>https://my-site.com/path
- ✅
`${{{URL base}}}/path`
=>https://my-site.com/path
Variables content can either be a string or a list of strings. Check out Valid value
types for more information.
Empty
Resets your variable as if it was never initialized.Append value(s)
A conveniant value that automatically transform your variable into a list of strings. It will append the value(s) to the list. 3 possible cases here:- If the variable is empty, it will create a new array with the provided value(s)
- If the variable is not an array, it will create a new array with the existing value followed by the provided value(s).
- If the variable is an array, it will concatenate the provided value(s) to the existing array.
Environment name
This will set your variable with eitherweb
or whatsapp
depending on the environment.
Transcript
This preset value will save the entire conversation transcript in a variable. It is super useful to provide context to an AI block or to send it as a recap with the Send email block.Result ID
This will set your variable with the current result ID. The result ID is the ID that corresponds to a row of your Results table. It can be considered like a User ID for the currently chatting user.Yesterday, Now, Tomorrow
This will set your variable with the specified date and time in ISO format. You can optionally provide a time zone to convert the date to the specified time zone.Random ID
This will set your variable with a random ID with the CUID algorithm.Moment of the day
It will set your variable with either one of these values based on the user’s time of the day:morning
, afternoon
, evening
, night
.
Then you can use this variable to conditionally display content:

Map item with same index
This is a convenient value block that allows you to easily get an item from a list that has the same index as an item from another list. When you are pulling data from another service, sometimes, you will have 2 lists:Labels
and
Ids
. Labels are the data displayed to the user and Ids are the data used for other requests to
that external service.
This value block allows you to find the Id
from Ids
with the same index as Label
in Labels

Phone number
Only available in WhatsApp. This will set your variable with the user’s phone number.Contact name
Only available in WhatsApp. This will set your variable with the user’s name.Save in results
By default, new variables are not persisted in the Results table. They are only stored for the current user chat session. Enabling this option will save the variable in theResults
table.
Execute on client
This option is useful when you want to execute the custom code on the client side. This is only necessary when you need access the user’s browser information. So, if you need access towindow
,
document
, navigator
, etc., you should enable this option.
Get user’s geo location
For this you can provide the following custom code:Advanced Features
JavaScript Expression Engine
The Custom value type provides a full JavaScript expression engine:Dynamic Array Management
Sophisticated array handling for complex data structures:Client-side Capabilities
Execute code in user’s browser for advanced functionality:Context-Aware Variable Setting
Smart variable management based on conversation context:- Session Variables: Temporary data that expires with the conversation
- Persistent Variables: Data saved to results table for long-term storage
- Linked Variables: Variables connected to user blocks for automatic updates
- Computed Variables: Variables that depend on other variables and update automatically
Best Practices
Variable Management Strategy
- Naming Conventions: Use clear, descriptive names (e.g., “User Email” not “email”)
- Scope Planning: Decide which variables need persistence vs session-only
- Type Consistency: Keep variable types consistent throughout the flow
- Documentation: Document complex variable relationships for team collaboration
Performance Optimization
- Minimal Processing: Keep JavaScript expressions simple to avoid delays
- Efficient Arrays: Use appropriate array operations (pop vs shift vs append)
- Client vs Server: Choose execution environment based on requirements
- Variable Cleanup: Reset or empty variables when no longer needed
Data Privacy and Security
- Sensitive Data: Use session-only variables for passwords or tokens
- Input Validation: Validate user input before storing in variables
- PII Handling: Be mindful of personally identifiable information storage
- External APIs: Secure API keys and sensitive endpoints in expressions
User Experience Considerations
- Loading States: Provide feedback during complex variable calculations
- Error Handling: Set fallback values for failed operations
- Mobile Compatibility: Test client-side code across devices
- Accessibility: Ensure variable-driven content works with screen readers
Example Use Cases
E-commerce Cart Management
User Personalization
Survey Response Processing
Dynamic Content Selection
Troubleshooting
Common Variable Issues
- Undefined Variables: Check that variables are created before use
- Type Conflicts: Ensure consistent data types (string vs number vs array)
- Scope Problems: Verify variables are accessible in their usage context
- Naming Conflicts: Avoid duplicate variable names that could cause confusion
JavaScript Expression Errors
- Syntax Errors: Validate JavaScript syntax before deployment
- Variable References: Use
{{Variable Name}}
syntax correctly - Return Statements: Remember that expressions auto-prepend
return
if not present - Null Handling: Check for null/undefined values before operations
Client-side Execution Issues
- Browser Compatibility: Test across different browsers and versions
- Security Restrictions: Some browsers limit certain operations
- Network Dependencies: Handle cases where external resources aren’t available
- Mobile Limitations: Consider mobile browser capabilities and performance
Array Operation Problems
- Empty Arrays: Handle cases where arrays might be empty
- Index Errors: Verify array indices exist before accessing
- Type Mixing: Ensure array elements are compatible types
- Memory Usage: Be mindful of large arrays in browser memory
Integration Challenges
- External APIs: Handle API failures and timeout scenarios gracefully
- Data Format: Ensure data formats match expected patterns
- Session Management: Handle session expiration and variable persistence
- Cross-platform: Test variable behavior across web and WhatsApp environments