
How Variables Work
Real-time Evaluation
Variables update instantly as users provide responses, enabling dynamic content and calculations throughout your chatflow.
Aliases & Expressions
Create readable names for data sources, then write JavaScript expressions using these aliases to perform calculations.
Chaining Capability
Variables can reference other variables, enabling complex multi-step calculations and data transformations.
Transparent Calculations
All calculations are visible and auditable through JavaScript expressions, ensuring complete transparency.
Common Use Cases
Financial Formulas & Computations
- Basic arithmetic:
income * 12
for annual salary - Advanced math:
Math.pow()
,Math.sqrt()
,Math.round()
- Financial calculations: loan payments, compound interest, ROI
- Statistical operations: averages, percentages, ratios
Variable Editor
Expression System
Variables use aliases connected to JavaScript expressions:1
Create Aliases
Define readable names for your data sources:
userAge
instead of complex resource referencesmonthlyIncome
for salary responsescreditScore
from external API calls
2
Write Expressions
Use JavaScript with your aliases to create calculations:
3
Test & Validate
Use the expression tester with mock values to ensure your logic works correctly before deployment.
4
Deploy & Reference
Use your variables throughout the chatflow in messages, conditions, and other variables.
Editor Features
Smart Autocompletion
- Ctrl+Space triggers intelligent suggestions
- Auto-detects available response fields
- Suggests variable names and functions
- Context-aware completions
Alias Management
- Visual mapping of aliases to data sources
- Automatic detection of undefined aliases
- Smart suggestions for missing connections
- Resource browser integration
Expression Testing
- Test expressions with mock values
- Validate complex calculations
- Debug multi-step logic
- Preview results before deployment
Error Handling
- Built-in null checking capabilities
- Default value support
- Type validation assistance
- Runtime error prevention
Where to Use Variables
Variables integrate seamlessly throughout your chatflow:Dynamic Content in Messages
Dynamic Content in Messages
Personalized CommunicationDisplay calculated values in messages using dynamic content. Perfect for showing personalized results, progress indicators, or calculated recommendations.Example: “Based on your income of $X, your recommended savings rate is Y%”
Conditional Flow Logic
Conditional Flow Logic
Smart BranchingUse calculated values in conditions to create intelligent flow paths. Enable complex eligibility checks, risk-based routing, and personalized user journeys.Example: Route users to different application processes based on calculated risk scores
Trigger Inputs
Trigger Inputs
External System IntegrationPass calculated values to triggers for external processing, API calls, or data storage. Enable complex data transformation before sending to external systems.Example: Send calculated financial metrics to CRM or generate personalized PDF reports
Nested Variable Chains
Nested Variable Chains
Complex Multi-Step CalculationsReference other variables to build sophisticated calculation chains. Break complex formulas into manageable, reusable components.Example: Base loan eligibility → Credit risk score → Final approval decision
Real-World Examples
Financial Services
Health & Insurance
Best Practices
Descriptive Naming
Use Clear Variable NamesChoose names that explain the variable’s purpose:
monthlyMortgagePayment
notpayment
userAgeInYears
notage
totalAnnualIncome
notincome
Error Prevention
Handle Edge CasesInclude validation and default values:
Modular Design
Break Down Complex LogicCreate smaller, reusable variables:
grossMonthlyIncome
→netMonthlyIncome
→loanEligibility
- Build calculation chains step by step
- Make debugging easier
Documentation
Document Complex FormulasUse descriptive variable names and comments:
- Explain business rules and assumptions
- Document data sources and calculations
- Include examples of expected inputs/outputs
Performance & Reliability
Real-time CalculationVariables are calculated instantly as users progress through your chatflow:
- Lightweight Processing - Client-side JavaScript execution
- No Server Delays - Calculations happen in the user’s browser
- Dynamic Updates - Values refresh automatically as inputs change
- Reliable Performance - No external dependencies for basic calculations
Calculation LimitationsVariables support standard JavaScript with some restrictions:
- Synchronous only - No async operations or API calls
- No function declarations - Use expressions and built-in functions
- Client-side only - Complex server-side calculations should use triggers
- Memory limits - Very large datasets should be processed server-side