A Beginner's Guide to Creating an Interactive Chatbot Flow in Teneo
In this tutorial, you'll learn how to branch after an output prompt and take different paths depending on the user response.
Join the DZone community and get the full member experience.
Join For FreeChatbots that can have human-like conversations are at the top of many company wishlists. To be able to create human-like conversations, there are certain capabilities the chatbot needs to possess — one of these is interactive flows.
An interactive flow is where the chatbot can ask for more information from the user before giving an answer; this enables more precise answers and creates a better user experience.
Here's a guide on how you create interactive flows in Teneo Studio, a conversational AI platform for enterprises.
In this tutorial, you'll learn how to branch after an output prompt and take different paths depending on the user response.
We'll use the following example, where the bot needs a confirmation from the user before it proceeds to reset the password:
User: I forgot my password.
Bot: Would you like me to reset your password?
User: Yes.
Bot: I've reset your password. You'll receive a confirmation email shortly.
or
User: I've forgotten my password.
Bot: Would you like me to reset your password?
User: No.
Bot: Ok, I won't reset your password.
This is what your flow will look like:

This page will only cover the communication with the user. To actually reset the password, you would have to create an integration. More on how to add an integration here.
Create the basic flow and populate the trigger
The first steps are mostly the same as when creating a simple question-answer flow (as, for example, your first flow).
- Select the 'Flows' folder and create a new flow with a class trigger via the Flow button.
- Once the flow has been created, a new window will open, enter the flow name
User wants to reset the password
into the name field. - After you have named the flow, hit the back button in the top left to get out to the actual flow.
- Let's go ahead and populate the trigger, select the class trigger, and make sure that the 'Learning Examples' panel to the right is active.
- Add the positive learning examples below either one by one or paste them all at once by clicking where it says 'No positive examples' and use the shortcut Ctrl+V (alternatively, you can right-click and choose Paste):
- Give the class trigger a descriptive name, for example
I forgot my password
(you will find the name field along the bottom of the window).
Can you reset my password?
I need some help with reseting my password
I forgot my password
Would you be able to help me reset my password
I have forgotten my password
I need a new password!
I want to reset my password
Password reset
Please can you reset my password
I've lost my password
I don't remember my password.
I have lost my password.
Reset my password please
Could you reset my password?
I have lost my pass word
Add answer texts to the output
Now we will populate the output node with answer texts. In this case, the output node will be used to ask a question to the user, rather than give a final answer.
- Select the output and add the following answers to the output node (use the Add button to add the individual answers):
Would you like me to reset your password?
Shall I reset the password for you?
Do you want me to reset your password?
- Give the output node a name:
Ask user for confirmation
.
Add a branch for user saying 'yes'
At this point in your flow, we expect the user to say either 'yes' or 'no'. Depending on what is said, the bot should react differently.
First, you'll design what should happen when the user says 'yes'.
- Select the output node 'Ask user for confirmation'.
- Click on 'Output' in the ribbon bar at the top. This will add an Output node, linked to the first output node via a transition.
Now the branch is in place. Teneo will automatically select the transition (the line that connects both output nodes) and open the 'Examples' panel for you.
Add a condition
Next, we need to make sure that Teneo only goes down this transition when the user says ‘yes’. To achieve this, we need to make the transition conditional and add a language condition. Language conditions can be generated from a set of examples or you can specify them directly. Let's generate one from a set of example inputs.
- First, we need to make the transition conditional by clicking the switch next to the label that says the transition is currently Unconditional. As you can see this will allow us to add example inputs and it will also open a second panel, called 'Condition'. In the examples panel, click the 'Positive' tab and paste the following examples:
Yes
Indeed
Yep
- Now we should generate a language condition based on the examples. Click the 'Now' button in the 'Condition' panel to tell Teneo to generate a condition using the example inputs.
After a few seconds, the condition field will get the value (%YES.PHR)
. This is the language condtion that was generated. As you may notice it refers to the language object called YES.PHR, which recognizes various phrases (hence the suffix .PHR) that mean 'yes', like 'by all means', 'absolutely' and 'yessir'. This perfectly covers our need for this transition. Note that there is a lot more you can do with language conditions, but that will be covered in the language understanding section.
Before we proceed, let's give the transition the name yes
. This makes the flow look nicer and makes debugging easier.
Add an answer text
To complete the 'yes' branch, we need to specify how your bot should respond when the user says 'yes'. Select the output node after the transition and add the answer text: I've reset your password. You'll receive a confirmation email shortly.
And finally, give the output a descriptive name like: I've reset your password
.
Add a branch and condition for user saying 'no'
Now, we'll specify what should happen when the user says 'no'. We'll follow the same steps as when adding the first branch:
- Select the output node 'Ask user for confirmation'.
- Click on 'Output' in the ribbon bar at the top. This will add an Output node, linked to the first output node with a transition.
- Make sure the transition is conditional. Add a few example inputs in the examples panel:
No
Never
Nope
- Generate the condition in the condition panel
- Give the transition the name
no
.
Do you see that there are numbers on the transitions (1 and 2 respectively)? These numbers represent the order in which Teneo will test the conditions.
Add an answer text and save the flow
Almost there! Next, we will add an answer to the final output and give it a descriptive name. For example:
Ok, I won't reset your password.
Finally, save your flow by clicking 'Save' in the top left or use the shortcut Ctrl+S.
Try it out!
That's it! If you'd like to test the flow from within Studio, minimize or close the flow, open the 'Try out' panel in the 'Solutions' window, and have a go.
Note: if you have just saved your flow, the 'Try out' panel will show "model training started" followed by "model training completed." This means Teneo is learning the new training examples you just created. After training has completed, you will be able to test the new content.
Well, if you want your AI strategy to be more than a one-trick pony, an advanced conversational AI platform is a good place to start.
Published at DZone with permission of Gareth Walters. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments