Use Conditional Match Requirements

In Teneo, we can use different kinds of match requirements in our flow triggers. We have already shown some examples of different ones. Now we will show you how to create a conditional trigger.

Both triggers with conditional match requirements and those with class match requirements can be built automatically from testing examples. The difference between the two is that with conditions, we have the ability to hand-tailor intent trigger using Teneo's condition syntax to either cover a broad use case or a very specific set of words and sentences.

We will now build a new flow for people that are interested in joining the Longberry Baristas' loyalty program, which will have a trigger with a Conditional Match Requirement and allow dialogs like the following:

User: How much does it cost to join the loyalty program?
Bot: You can join the loyalty program for free! Just ask your local barista for a club card and you're in!

The final result will look like this:

Final flow

Create a new flow

Let's start by creating a new flow to cover this intent.

  1. Click on the 'Flow' icon in the top ribbon.
  2. Name the flow User wants to know if loyalty program is free.
  3. Click the arrow in the top left corner of the window to go to the main flow window.

Populate the trigger

The next step is to populate the trigger to cover the testing examples:

  1. Select the trigger and name it Is the loyalty program free?.
  2. Open the 'Examples' panel on the right and paste the following testing examples into the field for positive examples:

Generate a condition

At this point we can either force Teneo to generate a match requirement or manually select one we are interested in. Let us start off by manually adding a Condition Match Requirement and automatically drafting a condition.

  1. Scroll down to the 'Match Requirements' section and click on the 'Add' button. This will toggle a drop-down list of different match requirements to select.
  2. Select 'Condition' and then click on the 'Advanced Options' button under the condition field.
  3. Finally, click on the 'Draft Condition' button. This will draft a condition based on the examples given to the trigger.

    Selecting 'Draft Condition' will replace any condition written inside the condition panel from the first place.

  4. After a while, the following condition will appear:

Here, we can see that Teneo used the example inputs to find matching language objects and combine them in a language condition. This is human-readable and, if we understand the syntax, it can be fine-tuned to suit our needs. For now, we will just use the condition as is; later, we will see how to further optimize this language condition in order to shorten and increase the coverage of a condition.

If you are developing using a language without any Language Resources, Teneo will generate a condition using plain words instead of Language Objects.

Add an answer

To finish the flow, we need to add an answer text to the output.

  1. Select the Output Node and name it You can join the loyalty program for free!.
  2. Paste You can join the loyalty program for free! Just ask your local barista for a club card and you're in! into the 'Answers' field on the right.
  3. Hit 'Save'.

That's it! We now have a flow that includes a trigger with a conditional match requirement.

Test yourself

Go ahead and test yourself by adding one more example, Can I join the loyalty program without paying? and draft the condition again following the steps from this page.

What is next?

We're finally done with the Flows chapter. Next up is the Conversations chapter.

Was this page helpful?