Sometimes your bot will need some additional information from the user before it can provide a final answer. On this page, you will 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?
Bot: I've reset your password. You'll receive a confirmation email shortly.
User: I've forgot my password.
Bot: Would you like me to reset your password?
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 integrate with a service, we will leave that part out for now.
The first steps are mostly the same as when you created Your first flow.
User wants to reset the passwordinto the name field.
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
I forgot my password(you will find the name field along the bottom of the window).
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.
Would you like me to reset your password?
Shall I reset the password for you?
Do you want me to reset your password?
Ask user for confirmation.
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'.
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.
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. Simply put, language conditions check if a user input matches a certain pattern. They can be generated from a set of examples or you can specify them directly. Let's generate one from a set of example inputs.
Yes Indeed Yep
After a few seconds the condition field will get the value
(%YES.PHR). This is the language condition that was generated. The language condition uses a 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 later.
Before we proceed, let's give the transition the name
yes. This makes the flow look nicer, and makes debugging easier.
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.
Now, we'll specify what should happen when the user says 'no'. We'll follow the same steps as when adding the first branch:
No Never Nope
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.
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 short-cut Ctrl+S.
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.
In these first tutorials you have familiarised yourself with some of the core concept of Flows in Teneo, like triggers, outputs, transitions and language conditions. There are many more possibilities for designing your dialogs, so this might be a good time to explore the Flows section. It is divided into two parts:
Let's continue to Flows.
Was this page helpful?