What are variables?
Variables are reusable pieces of data that can be referenced across the Chatbot to personalise the user experience and inject contextual information that can be used to route users through the conversation.
Types of variables
We distinguish 2 types of variables - Channel Variables and User variables that are different in the way they are integrated and secured.
|Channel Variables||User Variables|
|Recommended use case||👥 Non-sensitive information that can not identify user||👩 Sensitive information for a specific user|
|Integration effort||📉 Low||📈 Medium|
|Availability||Professional plan or higher||Customer 360 plan or higher|
|Examples||first name, current URL, app version||email address, billing address, full name, customer number|
Which type of variables to use?
Channel variables should always be used for non-personal user information that is available on your website.
For injecting user specific information choose the method that is in compliance with internal data protection policies and the regulations in your industry.
- Channel variables are not signed or encrtypted
- Channel variables can be manipulated via frontend
Some examples of data classification could include:
- PII - Personally identifiable information (different sensitivity levels)
- PCI - Payment card data
- PHA - Protected health information
- Sensitive/restricted - information sensitive in nature and restricted in its use and distribution
- Public - no additional confidentiality requirements
Your internal policies and industry regulatory requirements should define who can access the information depending on classification level and the acceptable ways to use it.
Setup in Solvemate Web App
To set up a new Variable in the Solvemate Web App:
- Go to Workspace > Variables
- To add new variable click on + Channel Variable or + User Variable (requires User Authentication) button
- Enter name of the new variable and press Enter
- Variable is created and available to be used
After the initial setup, variables of both types can be used in the exactly same way across the Chatbot.
Availability across the Chatbot
After either Channel variable or User variable is set up, it is globally available throughout Workspace.
|Question Custom button text||✅|
|Module Custom button text||✅|
|Module Confirmation question button text||✅|
|Form drop-down choices||❌|
|Pre-fill form fields||✅|
Variable usage in texts
There is a special format to use variables in Solution, Question, Bot Personality and/or configurations in the Web App:
- Starts with a dollar
- Is surrounded by curly braces
- Has optional fallback text after
Optional fallback text can be set for each variable in case it doesn’t have any value.
If fallback text is not specified and variable is not injected or has no value - it will be left blank in the texts displayed in the Widget.
- Fallback text should not be surrounded by quotes
Variable usage in forms
Once a variable is set up, it can be used in handover forms by choosing the variable from the drop-down list in Pre-Fill Variable field. This list contains all declared variables.
Variable usage with Context Questions
Variables can be used in Questions configuration to create Rules and auto-answer a question based on a variable value.
Standard properties such as integration type, enduser device, browser, platform and OS are available by default without any additional set up.
To set up logic Rules and conditions based on either Standard properties or variables, navigate to Workspace –> Conversation Builder, pick a question and select Configure question.
Expand Auto-answer conditions section and click on “Add Rule”.
In this view you can:
- pick a choice that the question will be automatically answered with,
- create any Rules for auto answer,
- create conditions in each rule,
- properties list contains all declared variables and Standard properties.
Variable usage in Function code
Both - Channel and User variables - are available to be used in functions code. You can access all declared variables in
import logging logger = logging.getLogger() logger.setLevel(logging.INFO) def handler(event, context): logger.info('token: %s', event['VARIABLES']) return 'Hello world!'
// Coming soon!
Mobile apps (Widget page)
If the bot is integrated not only on a website but also in a mobile app by rendering Widget (hosted on expert.solvemate.com) in a webview, as of now, injecting variables is not possible.
In case variables are set up in the Web App only Fallback texts will be displayed in the Widget accessed from the mobile app.
To overcome this limitation and use variables from the mobile app, we recommend: