TUTORIAL #6: Changing conversation flow using variables and tags

In our previous tutorial, we learned how to create a bot that uses Xenioo’s Natural Language Processing engine to detect and react to user input.

In this lesson we will expand the example further by creating different switches that alter the chat flow, thereby ensuring that our pizza order is complete.

You can follow our lesson directly from the video below. At the end of the post you will find a Xenioo bot file that simply restores the example bot into your account for playback and testing. Let’s start!

Xenioo Tutorial: Changing conversation flow using variables and tags

The missing entities

As we complete our NLP configuration and test our bot we can notice one simple detail: some phrases we accept may contain the pizza size, some others may contain information about the topping and sometimes, we can get both.

This situation can happen very often when dealing with free user input: each user will express an intent differently and may place an order (or anything else in your chatbot) in just a partial way.

“A large one!” or “One with onions” are human valid answers to our pizza ordering tutorial chatbot. 

Xenioo Conditional Actions can help you manage these situations by checking the values of your variables, and redirecting the user to a relevant interaction.

Conditional Switches

Variable and Tag Conditional Switch Action are among the most powerful Xenioo actions: they allow you to create switches in the conversation that can redirect the chatbot to other interactions, based on the content of a variable or on the existence of a tag.

Going back to our initial example, we’ve already seen how our NLP will store all detected entities into variables.

In our pizza ordering chatbot, we have two variables available: size and topping. Let’s add a check for both.

In our chatbot designer, let’s add a new interaction that we will call “Order Check”. Once created, click on the Add Action button to add a new action. From the Available Actions menu, select Variable Condition from the Flow tab.

We will check for size first. In the Variable Name just type size and in the criteria menu select ‘Empty Or Unset’. Notice how the criteria value field disappears as you select this type of criteria: there’s no need to specify a check value in this case.

Now we need to add an operation that, if size is empty or unset, will move our conversation to an action that can ask the user for this value. Let’s add a Go To Interaction operation to the Variable Condition Switch action.
Use the plus button attached to the Interaction menu to create a brand new interaction and save everything to confirm the connection.

Completing the Order

In the target interaction we are going to ask the user to tell us the desired pizza size.

We can create a specific NLP Intent to detect more complex replies (and we encourage you to experiment!) but for our example, we will just use a simpler Generic Input Action.

This action can filter a user input based on a simple regular expression. Since we’re accepting either small, medium or large, we’re going to specify a very simple expression and grouping for these values: (small)(medium)(large).

It’s as simple as that!

Now as the user can complete this information, we may go forward a step to ensure that the toppings are selected using the very same technique.

The checking approach is up to you: you can either have a step that checks all variables and redirects accordingly or have a step by step check, like in our video example.

Xenioo Actions and Operations allow for a great deal of freedom for you chatbot.

With this tutorial you’ve learned how to switch the flow of your chatbot conversation based on variables and user input and witnessed how incredibly powerful the Xenioo Actions and Operations architecture is.

As with all our lessons, you can find the chatbot sample in your Xenioo account so that you can import it to further experiment and learn.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Why starting with Xenioo ?

Registration is FREE and you can instantanely publish your chatbots on
Facebook Messenger, Whatsapp, Telegram, Web Sites, Slack, Amazon Alexa and Google Assistant