After Matches
After Matches are actions which are executed and evaluated only after the trigger or transition has been triggered. This page provides information related to the various After Match actions available in Teneo Studio, including step-by-step guides on how to add, edit or delete an After Match.
The sections on this page provide information about the various aspects of After Matches:
Concept
After Matches are used to perform an action in a trigger or transition that has been triggered through matching. An After Match can be set for a trigger or transition and they are only executed after the trigger or transition has been triggered. This means that a Match must match before the After Match is performed.
An After Match can be used to perform the following actions:
- Transfer information from a Language Object to a Flow.
- Define a specific condition to be met before the Flow executes a Script.
- Trigger a Listener in a trigger or transition.
- Extract an Entity mentioned by the user.
The After Matches are executed in the same order as they are listed, just like regular Matches. Once triggered, an After Match will execute an action depending on what has been selected.
A common use case of After Matches is extracting entities from user input in order to avoid repetitive questions, for example when slot-filling. Sometimes the end-user will tell the bot the answers of certain questions before they are expected and, to make conversations flow more naturally, the bot can be told not to ask questions when the answer to these are already known.
This can be done as follows:
- add an After Match after the User Intent trigger to ensure that the bot listens for information.
- add a User Intent transition where the question is only asked in situations where the answer was not already given.
- add an additional path to skip the question in the Flow for cases where the answer is already known.
Note that an After Match action is optional, where the input is not forced to trigger it. Once triggered, After Match actions will execute your Mapping or Script depending on which you've selected. If you want to ensure an After Match action is executed, you will need to ensure that the Match preceding that After Match is met.
For Entity or Language Object After Matches, the action executed will be a variable Mapping. For Listener and Script After Matches, this action will include an execution Script.
When handling variables in Mapping, the 'Source' field denotes the value of the NLU variable of the entity that we want to store and the 'Target' field denotes the name of the variable where the extracted value is to be stored.

Choose an After Match
Choosing an After Match or the combination of various After Matches always depends on the particular use case and the dialogue requirements. The following sub-sections intend to provide guidance for deciding which After Match action to use.
After Match Types
There are four After Match types available in Teneo Studio:
- Entity
- Language Object
- Listener
- Script
Entity
An Entity After Match is executed only for inputs that match the selected Entity.
When an Entity After Match is added, it is possible to add a number of mappings from one of the NLU Variables of the Entity; every time a new input matches the Entity, the values in the source are stored in the selected targets. The same source can be selected multiple times, but each target can just be selected once (as multiple values would overwrite previous ones).
It is possible to use After Match actions to extract the values stored inside an entity. If the user selects Entity as an After Match, they will need to define which Entity they are interested in. Once that is defined, the user will have the option to 'Add Mapping' and transfer the values from 'Source' to 'Target'.
There is no mandatory connection between Entities matched in the list of Matches and those added to the After Matches, i.e. Entity After Matches can be defined even if no Entity Match is defined or even for different Entities.
Language Object
The Language Object After Match is executed only for inputs that match the syntax of the selected Language Object.
When a Language Object After Match is added, it is possible to add a number of mappings from one of the NLU Variables of the Language Object to Global or Flow Variables; every time a new input matches the Language Object's syntax, the value in the source is stored in the selected target. The same source can be selected multiple times, but each target can be selected only once (as multiple values would overwrite the previous ones).
There are some cases where the Language Objects store NLU values inside them. The user has the option to access these by using After Match actions on Language Objects. While selected, the user must define which Language Object they are interested in. Once that's defined, the user will have the option to 'Add Mapping' and transfer the values from 'Source' to 'Target'.
There is no mandatory connection between Language Objects matched in the list of Matches and those added as After Matches, i.e. Language Object After Matches can be defined even if no Language Object Match is defined or even for different Language Objects.
Listener
The Listener After Matches are activated whenever the User Intent trigger or transition is triggered and the TLML syntax of the Listener matches the user input. In those cases, the Groovy script expression of the Listener is executed.
A Listener After Match is helpful when you want to extract information from the user input based on TLML syntax.
If you do not know when the user input you want to extract will be present in the Flow, it is better to use a Flow Listener instead. This will listen to user inputs throughout the Flow and not only for specific triggers or transitions.
If a Flow should pick up two dates from a user (like an arrival and departure date for a holiday), you can add one Listener After Match to the transition where the user is asked for the arrival date and another Listener After Match to the transition for the departure date. This way you ensure that the dates do not get mixed up in the Flow.
Script
In Script After Matches, the user can write Groovy scripts which are executed whenever the User Intent trigger or transition is matched.
How To
Add an After Match
- Teneo Studio Desktop
- Teneo Studio Web
To add an After Match action in Teneo Studio Desktop, follow these steps:
- In the Flow editor, click the Plus icon where information should be extracted or a script executed or alternatively, select the trigger or transition where the After Match action should be added, and click Add in the After Match section of the right-side panel.
- In the After Match group, choose one of the following:
- extract the value of a Language Object variable (if it matches the input) (Language Object)
- execute a script when the input matches an additional TLML Syntax rule (Listener)
- extract the value of an Entity variable (if present in the input) (Entity)
- store the words which matched as a variable/execute a script (Script)
- After selecting one, the right side panel is opened, and the After Match section marked with TODO.
- Now, define the specifics of the After Match that you have selected:
- For the Language Object After Match, write the name of the After Match and Add Mapping if applicable.
- For the Listener After Match, write the TLML Syntax and the Execution Script (Groovy).
- In the Advanced Options, adjust the following settings as needed:
- Test sentence from: Last to first or First to last.
- Limit unused words to: select numeric value.
- Stop after: All sentences tested, First match or Current sentence tested.
- In the Advanced Options, adjust the following settings as needed:
- For the Entity After Match, write the name of the After Match and Add Mapping if applicable.
- For the Script After Match, write the Execution Script (in Groovy).
- Remember to Save the Flow to preserve the changes.
New After Matches are inserted at the top of the list; a handle to drag/drop them into the desired order is available in the top-right corner of the After Match section.
In the Flow editor, follow the below steps to add a new After Match:
- Click the Plus icon where you want to extract info or execute a script.
- In the After Match group, choose to either:
- extract the value of a Language Object (if it matches the input) (Language Object) by selecting a Language Object and adding a Variable Mapping; start writing the name of the wanted Language Object to filter the list by Language Object name
- execute a script when the input matches an additional TLML Syntax rule (Listener) by defining a syntactic condition which should be met for the defined Groovy script to be executed
- extract the value of an Entity variable (if present in the input) (Entity) by selecting an Entity and adding a Variable Mapping; start writing the name of the wanted Entity to filter the list by Entity name
- execute a script (Script) by entering a Groovy script.
- Remember to Save the Flow to preserve the changes.
When adding an After Match Language Object or Entity, the initially displayed list of suggestions (before writing anything in the text field) contains a list of the 20 most recently added or modified Language Objects/Entities.
Edit an After Match
- Teneo Studio Desktop
- Teneo Studio Web
To edit an existing After Match follow the below steps:
- Select the trigger or transition where the After Match is defined.
- In the right-side panel, modify the needed details in the After Match section.
- Remember to Save the Flow to preserve the changes.
To edit an existing After Match follow the below steps:
- Select the After Match node in the Flow.
- Edit the wanted details.
- Remember to Save the Flow to preserve the changes.
Delete an After Match
- Teneo Studio Desktop
- Teneo Studio Web
- In the right-side panel, click the cross (X) available in the top of the After Match's field.
- Remember to Save the Flow to preserve the changes.
- Go to the After Match node in the Flow.
- In the node, click the Recycle Bin in the sidebar.
- Remember to Save the Flow to preserve the changes.
UI
Plus Icons
- Teneo Studio Desktop
- Teneo Studio Web
| Plus Icons | Description | Related Pages |
|---|---|---|
| The Plus icon below the trigger node allows to define After Matches for the selected trigger. | User Intent Flows | |
| Plus icons throughout the Flow graph allows to define After Matches for the selected transition. | Transitions Flows |
| Plus Icons | Description | Related Pages |
|---|---|---|
| The Plus icon below the trigger node allows to define After Matches for the selected trigger. | User Intent Flows | |
| Plus icons throughout the Flow graph allows to define After Matches for the selected transition. | Transitions Flows |
After Matches
- Teneo Studio Desktop
- Teneo Studio Web
| After Match Type | Description | Related Pages |
|---|---|---|
| Any values from the mapped source variables will be stored in the selected target variables if the user input matches the Entity. | Entities Entity Match | |
| Any values from the mapped source variables will be stored in the selected target variables if the user input matches the Language Object. | Language Objects Language Object Match | |
| The script of the Listener After Match will be executed if the user input matches the TLML syntax. See more on Advanced Options below this table. | TLML Syntax Match Flow Listeners Scripting TLML Syntax | |
| A Script After Match is unconditional and will always be executed once the Trigger or Transition is matched. | Scripting |
*In Teneo Studio Desktop, just below the Syntax editor, the Advanced Options provide the following three options:
-
"Test sentences from" enables the developer to select if the sentences in the user input should be tested from "Last to first" (default setting) or "First to last", i.e., when the user input is made up of more than one sentence, "Last to first" tests the last sentence in the input first and moves backwards while "First to last" tests the first sentence first and continues moving forward.
-
"Limit unused words to" allows to limit the number of unused words present in the user input by specifying a maximum number of words which the user input may contain besides those matching the TLML syntax for the match to be satisfied; see also Unused Word Limitation.
-
"Stop after" permits selecting when Teneo Engine should stop testing sentences and provides the following options:
-
All sentences tested: the TLML syntax of the Listener is tested against all the sentences in the user input creating an array of results.
- First Match (default): testing is stopped when a match is found.
-
Current sentences tested: the TLML syntax of the Listener attempts to match against the most recent syntax (the previous trigger or conditional transition).
| After Match Type | Description | Related Pages |
|---|---|---|
| Any values from the mapped source variables will be stored in the selected target variables if the user input matches the Entity. | Entities Entity Match | |
![]() | Any values from the mapped source variables will be stored in the selected target variables if the user input matches the Language Object. | Language Objects Language Object Match |
![]() | The script of the Listener After Match will be executed if the user input matches the TLML syntax. | TLML Syntax Match Flow Listeners Scripting TLML Syntax |
| A Script After Match is unconditional and will always be executed once the Trigger or Transition is matched. | Scripting |
Practical Examples
Adapt to User Input
Extract Entities from User Input
Sometimes the user tells you the answer to certain questions earlier than expected. As mentioned in the concept section, we can make use of After Matches to define an additional path and to make the conversation flow more naturally.
Let's take a look at an example solution, where we are implementing a Flow to handle coffee orders. Before adding the additional path, we may run into conversations like this:
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 the additional path, we can avoid the above and get more natural conversations, like this:
User: I'd like to order a Cappuccino.
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.
Our example Flow is called "User wants to order a coffee". To pick up a coffee type if mentioned in the first user input, we will use an Entity After Match on the User Intent trigger.
Add Flow variable
First, we need a variable in our Flow to hold the coffee type mentioned by the user.
- Teneo Studio Desktop
- Teneo Studio Web
- In the flow's main window, move to the 'FLOW' tab, and select 'Variables'.
- Add a variable and name it
orderedCoffeeType. - Put
""in the 'Initial Value' field. This initializes the variable with the empty string.
- Add a new variable below the flow descriptions and give it the name
orderedCoffeeType. - Put
""in the 'Variable value' field. This initializes the variable with the empty string.
Add Entity
Next, we will create an Entity to define what coffee types we want our solution to recognize when mentioned in the user input.
- Teneo Studio Desktop
- Teneo Studio Web
- In the main solution window, click on the Entity icon in the ribbon bar.
- A new window will open. Name the entity
COFFEES_SERVED(the type .ENTITY is automatically defined). - Click on the back arrow to go to the Home tab of the Entity, where you will be able to edit it.
- Copy the following table onto the clipboard:
Coffee name coffeeType %AMERICANO.NN.LEX americano %CAPPUCCINO.NN.LEX cappuccino %CORTADO.NN.LEX cortado %ESPRESSO.NN.LEX espresso %FRAPPUCCINO.NN.LEX frappuccino %LATTE.NN.LEX latte %LUNGO.NN.LEX lungo %MACCHIATO.NN.LEX macchiato %RISTRETTO.NN.LEX ristretto %MACCHIATO.NN.LEX macchiato brewed coffee brewed coffee filtered coffee brewed coffee - Inside the Entity, select the cell marked 'Click here to add a new entry'.
- Paste the table you copied earlier.
- You will now be prompted to say whether the data you pasted includes a row of headers or consists purely of data. In our case, the first row consists of headers, so select 'First row is variable names'. If you experience unexpected behavior in this step try copying the table by highlighting it rather than using the 'copy' button.
- Hit 'Save'.
- Navigate to a folder where you want to store your Entity and click on the Plus icon, followed by the Entity icon (when you hover over it, you should see the text 'Create new Entity'.
- Call the entity
COFFEES_SERVED(the type .ENTITY is automatically defined). - Click on 'Create'. The newly created Entity should open automatically.
- Inside the Entity, click on 'Add string variable'.
- Name the string variable
coffeeType. - Next, select the option to Add entry.
- Add entries into the Entity window to define the list of coffee types. For example:
Coffee name coffeeType %AMERICANO.NN.LEX americano %CAPPUCCINO.NN.LEX cappuccino %CORTADO.NN.LEX cortado %ESPRESSO.NN.LEX espresso %FRAPPUCCINO.NN.LEX frappuccino %LATTE.NN.LEX latte %LUNGO.NN.LEX lungo %MACCHIATO.NN.LEX macchiato %RISTRETTO.NN.LEX ristretto %MACCHIATO.NN.LEX macchiato brewed coffee brewed coffee filtered coffee brewed coffee - Hit 'Save'.
Add After Match
Now that we have a Flow variable and an Entity to store coffee types, we just need an After Match in our Flow:
- Teneo Studio Desktop
- Teneo Studio Web
- Open a Flow in edit mode.
- Select the first trigger node to open the trigger configuration panel.
- Scroll down to the After Match section and click on Add followed by Entity to extract values from an Entity.
- Paste in the Entity name,
COFFEES_SERVED.ENTITY. - Click on 'Add Mapping' below the Entity name.
- Now use the drop-down menu below to determine the source variable, which is the string variable in our Entity, 'coffeeType'. Then do the same for the target variable, which is the Flow variable, 'orderedCoffeeType'. This transfers the value from the source and assigns it to the target.
- Open the Flow.
- Under the first User Intent node, click on the Plus icon followed by 'After Match' and 'Entity'. We will use this to extract values from an Entity.
- Paste in the Entity name,
COFFEES_SERVED.ENTITY. - Click on 'Add Variable Mapping' below the entity name.
- Now use the drop-down menu below to determine the source variable, which is the string variable in our Entity, 'coffeeType'. Then do the same for the target variable, which is the Flow variable, 'orderedCoffeeType'. This transfers the value from the source and assigns it to the target.
Specify when outputs should be skipped or given
This example shows how to specify when an Output should be skipped or given:
- Teneo Studio Desktop
- Teneo Studio Web
- Select the Output node in the Flow which is before the Give Response label to open the right side Output configuration panel.
- In the middle of the Output panel, look for the Skip Conditions field to add a skip condition.
- Now, add the skip condition to the field (for the sake of the example, let say
orderedCoffeeType). This will be evaluated to true if the named variable is set and to false if the variable is empty. - Lastly, use the drop-down menu besides Skip to to determine how the Flow processing should continue.
- Remember to Save.
What we are doing here is telling Teneo that if the variable (e.g., orderedCoffeeType) has a value when reaching the next Output node, then skip it and traverse the path without waiting for a user input.
- Click on the Plus icon below the Raise label, followed by Continue with and Junction
- Click on the Plus icon below the Raise label again, this time selecting Match and Flow variable
- In the dropdown menu, select the variable name (for the sake of the example, let's say
orderedCoffeeType). - In the Evaluation script, paste
""
The existing path will now only be executed if the value of the variable is empty. Now, let's also add the path the bot should take if the variable has already been assigned a value in the After Match where the coffee type, for example, is picked up from the user's first input:
- Hover over the arrow beneath the junction that does not go to the existing path, there should be a small green dot.
- Click and drag to create a new path from the junction to the next node which the user should visit.
- Remember to Save the Flow to preserve the changes.
To summarize, we check whether the first user input contains a coffee type and, if it does, we store that in the variable set up for this. After the junction, the user is then either asked for the coffee type or the path is skipped until the selected node.

