Variables store and transfer data throughout a bot’s flow, so you can personalize interactions and integrate with external APIs.
Variables have different scopes, determining where they can be accessed:
- Workflow Variables Exist only within a single workflow. They’re Useful for temporary data like AI-generated outputs or user responses.
- User Variables Persist across multiple conversations and should Store user-specific data like preferences or IDs.
- Bot Variables are Shared across all users and conversations and are used for static configuration values.
- Configuration Variables Securely store secrets like API keys and database credentials.
You can reference variables using {{scope.variablename}} or @scope.variablename in messages and code.
Input and output variables allow the data contained in your variables to be passed between workflows.
Variables support multiple data types, including types like String, Boolean, Number, Date, Object, and array.
You can create variables in the Variables tab or dynamically within an Execute Code card.
Botpress also provides special system variables, like conversation summaries, translations, and transcripts, that you can access via their corresponding agent.