Teneo Developers

Getting started

Quite often users will ask a follow-up question to an answer your bot just gave, like so:

User: I want to order one espresso
Bot: Ok, a espresso will be ready for pickup in 5 minutes.

User: I'd like one more (follow-up)
Bot: Ok, what coffee would you like?

User: Flat white this time
Bot: Ok, a Flat white will be ready for pickup in 5 minutes.

As you can see in the example dialogue above, follow-ups are quite often very generic inputs that can have different meanings depending on the context of the conversation. In the example above, the user wants to order another cup of coffee; however, in a different context, the user might have meant to place the same order again, for example.

There are different ways to manage dialog context in Teneo. We will now explain one way: dealing with inputs that can be considered direct follow-ups to the same flow. We are going to implement the example dialog above by adding a context-dependent trigger to the coffee order flow flow that we created earlier.

What we will do is the following:

  • Add a second trigger to our flow.
  • Make the trigger context dependent using the Match for Context, Follow up of Flow.

The final result will look like this:

flow layout

Let's get started!

Add a second trigger to the flow

Go ahead and add a second trigger to handle the follow up questions:

  1. Open the flow 'User wants to order a coffee' in edit mode.
  2. Click on the Plus icon next to the existing trigger, followed by Add Trigger.
  3. Give the trigger the name Another one please.
  4. Add Intent examples to the newly created flow trigger:

example-inputs

1Another one
2Can I order another one
3One more
4Can I make one more order
5Another order
61 more
7
  1. Generate a Match by pressing 'Generate' on the Match section. This will create a Class Match.

Make the trigger context dependent

We are going to context restrict the second trigger 'Another one please' so it only fires if the same flow has just been active. To achieve this we are going to use a global scripted context which uses a script to evaluate if a context is true.

  1. Select the 'Another One' trigger to open the configuration panel.
  2. Scroll down to the Match section and 'Add' a new 'Scripted Context'.
  3. From the dropdown, choose the global context 'Follow up of Flow'.
  4. Make sure the value chosen is sameFlow (it will be chosen by default).

The global scripted context 'Follow up of Flow' only evaluates to true if the context restricted trigger exists in the same flow as the previously fired flow. For more details, see: Predefined context restrictions.

Save and test your flow

That's it! Now you can save the flow and give it a try in the Tryout window.

First try a working case:

User: I want to order one espresso
Bot: Ok, a espresso will be ready for pickup in 5 minutes.

User: I'd like one more (follow-up)
Bot: Ok, what coffee would you like?

User: Flat white this time
Bot: Ok, a flat white will be ready for pickup in 5 minutes.

Now restart your Tryout session by clicking the 'restart' button, this will start a clean session without any dialog history. Then try the following input that you would normally use as follow-up, but this time without any preceding question:

User: I'd like one more.
Bot: I'm sorry but I didn't get that.

Next page
Theory/Core Concepts
Was this page helpful?