A large cellular carrier deploys a multi purpose chatbot to help users operate their device, perform various actions, ask questions and even have a small talk chat.
The user’s identity is automatically acquired when they initiate contact, from the company DB. Other basic parameters about this user are also loaded at this point, such as age, gender etc.
The system is based on a general “lobby” component. It’s designed like a switchboard, deciding which component should be activated according to the user’s input and the chatbot’s agenda. In this particular case, the bot was designed to ask the user for missing parameters, and also promote a special sales offer.
GAME ON! DID YOU RSVP TO OUR MEETUP NEXT WEEK? DO IT HERE!
This component-based architecture allows for mid-air context switching (back and forth if needed) between independent components. This also means that above these two contexts there is a higher level: The meta-context of the entire conversation, which includes (among others) the user’s personal details. These details are actually global variables: Parameters shared by all the components that make up the entire Chatbot.
In order to facilitate global variable value in a componentized environment, they need to be passed to the current component when it is invoked, while others need to be passed back when the component is done. Each component has an (optional) list of parameters it expects to receive upon activation, as part of the query. Alternatively, it can be exposed to the entire context of the convo (determined by user id and session id), consisting of global variables. The calling bot is assumed to hold all values used by all participating components.
WHO SHOULD USE Global variables?
Global variables are especially important in case the system serves returning users. It’s opposed to bots designed to interact with strangers, assuming each convo is conducted with a new user. Customer service bots, personal companions and similar use-cases require a level of acquaintance, and sometimes even intimacy. The chatbot must retain pieces of information disclosed by the user throughout the relationship, provided the user gives his consent at the outset of the experience. The bot must also remember which topics were already used (exhausted) in preceding sessions, to avoid repetitions. It must remember user preferences, likes and dislikes. These are all values that need to be saved in the company’s database.
Use of global variables is unavoidable if the system services returning users, and are typically associated with their personal data (userfirstName, userlastName, userHomeAddress.full, phone_number, userInfo.email, user_profession), user settings or preferences (reminder.datetime, reminder.note, survey_results, quiz_results) and other values that need to be saved for future use (scheduled_appointment, user_complaint, request_live_agent). In addition, the chatbot must also remember conversation topics already used with a particular user, to avoid repetition.
- More words of wisdom
- How to build a bot using the four-turn template?
- Conversational AI: Some basic terminology
- The Feedback Loop: A basic chatbot development process
what kinds of global variables are we using?
Some of these values are used by many of the components composing the whole bot. The user’s first name, age, and perhaps other variables which are relevant in several parts of the entire convo. But most of the global variables are typically shared only between the Root component (or glue, or lobby – the top component) and another special-purpose component which handles the variable in question. A scheduled appointment time is only relevant to the scheduling component.
As already noted above, there are 2 ways to design the use of global vars for a multi-component bot:
(1) Share the context (all variable values), at the start of the convo, all equally accessible from all components, or
(2) When calling a component, pass the relevant variables as parameters.
When all the components composing the chatbot are built using the same platform, the first approach is more convenient, as all variables are local and shared. However, when the chatbot is composed of components built on different platforms, there is no way to unify the environment. Therefore, the only component that knows all global vars is the Root component. This component is in charge of passing the required parameters to the relevant component being called.
Global variables are a fundamental element in every multi purpose personalized chatbot.