Variables

Variables overview

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
Security 🔓 Medium: Values are passed to the Chatbot via frontend using JavaScript. These variables are neither signed nor encrypted. 🔒 High: Values are fetched in the background from your API with a unique jwt that you provide
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:

  1. Go to Workspace > Variables
  2. To add new variable click on + Channel Variable or + User Variable (requires User Authentication) button
  3. Enter name of the new variable and press Enter
  4. Variable is created and available to be used
Add variables

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.

Text input Availability
Solution description
Solution title
Question description
Question title
Question Custom button text
Question choices
Module description
Module title
Module Custom button text
Module Confirmation question button text
function code
Bot Personality
Form drop-down choices
Pre-fill form fields
Context Questions

Variable usage in texts

There is a special format to use variables in Solution, Question, Bot Personality and/or configurations in the Web App: ${variable_name|fallback text}.

  • Starts with a dollar $ sign
  • Is surrounded by curly braces { }
  • Has optional fallback text after |
Variable syntax

Fallback text

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.

Forms

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

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.
Context questions

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 event['VARIABLES'].

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: