Getting started
Sometimes the user tells you the answer to certain questions earlier than expected. It is important to be prepared for these instances by combining the use of 'After Match' and 'Skip Conditions'. This combination will allow the flow to extract information with 'After Match' and skip the questions we already know the answers to with 'Skip Conditions'.
Before adding 'Skip Conditions':
User: I'd like to order a Cappuccino
Bot: Ok, what coffee would you like?
User: I already told you, a Cappuccino!
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.
After adding 'Skip Conditions':
User: I'd like to order a Cappuccino.
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.
Extract entities from the first input
The current stage of the 'User wants to order a coffee' flow doesn't extract the entity if you mention a coffee type in the first input. To do that we need to add another data action on entities but this time for the trigger:
- Open 'User wants to order a coffee' in edit mode.
- Select the 'Order a coffee' trigger node, this will open a trigger configuration panel.
- Scroll down to the 'After Match' section and click on 'Add' followed up with 'Entity' to extract values from our previously created entity.
- Paste in
COFFEES_SERVED
. - Click on 'Add Mapping' below the entity name.
- Now use the drop-down menu below to determine the source coffeeType and the target orderedCoffeeType. This transfers the value from the source and assigns it to the target.
Specify when outputs should be skipped
Now it's time to specify when output should be skipped:
- Select the 'Ask for coffee type' node to open the output configuration panel to the right.
- In the middle of the output configuration panel, you will find the 'Skip Conditions' field. Click on 'Add' to create a skip condition.
- Paste
orderedCoffeeType
into the 'Skip Conditions' field. This will be evaluated to true if the variable is set and to false if the variable is empty. - Now use the drop-down menu beside 'Skip to' to determine how the flow processing should go on. In this case it should be 'User responds with coffee type'.
- Hit 'Save'.
What we have done here is to tell Teneo: if the orderedCoffeeType has a value when you reach the 'Ask for coffee type' output node, skip it and traverse the path 'User responds with coffee type' without waiting for an input from the user.
Test the scenarios
Now it's time to test the flow!
User: I'd like to order a coffee.
Bot: Ok, what coffee would you like?User: A cappuccino, please.
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.
It is now possible to put all details into one single request:
User: I'd like to order a cappuccino.
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.