Teneo Developers

Global Listeners

Introduction

A Global Listener listens for user input anywhere in the solution; this type of Listener can be used when wanting to listen for certain user inputs regardless of the Flow or transition.

View of Global Listeners

The Global Listeners are available in the backstage of Teneo Studio by clicking Solution tab in the main window of Teneo Studio, then Globals and lastly Listeners.

Studio backstage Global Listeners

In this view, the user will find:

  • Left side:
    • Text filter
    • List of existing Global Listeners
    • Listener Ordering including buttons to set/unset stable
  • Right side:
    • Ribbon options allowing to Edit, Delete, view History, set/unset Stable version, include/exclude in branching (Localization setup)
    • Details of the selected Listener providing a read-only summary
    • Global Listener's Id

Global Listener window

When clicking Add or Edit, the Global Listener window will open; the window consists of two tabs: Listener allowing to access the backstage of the window and the Home tab presenting the main view of the the Global Listener.

The Home tab of the Global Listener window contains the following:

  • Top ribbon
  • TLML Syntax and Execution Script fields
  • Advanced settings, including
    • Sentence test order
    • Limit unused words
    • Stop after

Global Listener window

The Listener tab consists of a left-side menu with the following options and information:

  • Save allows to save the current version of the Global Listener
  • Properties allows to edit the name and description of the Global Listener
  • History contains the history and lists former versions of the Global Listener
  • Close allows to close the Global Listener window

See the Edit section for more details.

Basics

Open

To open a Global Listener from the backstage of Teneo Studio, simply double-click the Listener; alternatively click the Edit button available in the right-side top of the view.

Create

To create a new Global Listener, follow the below steps:

  • In the Global Listeners view, click Add and select Pre-Listener or Post-Listener in the dropdown
  • The new Listener window opens
    • Write a Name and optionally a Description
    • Click the back-arrow in the top left corner when done
  • In the TLML Syntax field, write the syntax that will be used when testing user inputs
  • In the Execution Script field, write - in Groovy - what the Listener should do when the TLML syntax is matched
  • If required, the following properties can be modified below the Execution Script field:
    • Test sentence from: select either Last to first (default) or First to last
    • Limit unused words to: tick this option to set the number of accepted unused words
    • Stop after: select between First match, Current sentences tested (only Global Post-Listeners) and All sentences tested
  • Remember to click Save in the top ribbon.

Edit

After opening the Global Listener, the user is able to modify the wanted specifications; below please find an overview of the available options and buttons. Also refer to the above Create section.

Global Listener: top ribbon

The Listener's top ribbon provides the below specified buttons.

SectionButtonCommentMore information
ListenerCloseClose the Global Listener window
SaveSave the Global Listener in the current state; clicking the lower part of the button allows the user to save the Flow with or without a comment
ExecutionOpen With...Allows to open the script in an external script editor; when the button is clicked for the first time the user will be prompted to select the script editor
EditUndo/RedoUndo/redo changes performed in the Global Listener
Stable VersionSet/UnsetSet the current version of the Global Listener as stable or unset itVersion flag
BranchingInclude/ExcludeInclude or Exclude the Global Listener from branching when working in a Localization setupLocalization setup

Listener tab

The backstage of a Global Listener (Listener tab in the top of the Listener's window) contains the below menu items.

Menu itemCommentMore information
SaveSave the Global Listener in the current state
PropertiesAllows to edit the name and description of the Global Listener; the Id of the Listener is available in the lower area of the window
HistoryLists the history and versions created each time the Global Listener is saved, comments added at save are displayed here.Open a previous version by clicking the version number; restore a previous version by opening the specific version and clicking Restore in the top ribbonVersion flag
CloseClose the Global Listener window

Save

To save a Global Listener with a comment follow the below steps:

  • Click Save in the top ribbon of the Global Listener
  • In the dialogue box (optionally) write a comment
  • Click OK

To save directly and bypass the comment, press the Alt key while clicking the Save button.

Close

To close a Global Listener, either:

  • Click the X in the top, right corner of the Global Listener window
  • Click the Close button available in the top ribbon
  • In the Global Listener's backstage, click Close in the left-side menu

If there are unsaved changes Teneo Studio will prompt the user to Save or Close without saving.

Delete

To delete a Global Listener, follow the below steps:

  • In the backstage of Teneo Studio (Solutions tab > Globals > Listeners) select the Listener(s) to delete
  • Click Delete in the top, right side of the list
  • Teneo Studio prompts the user to confirm the deletion of the selected Listener(s)
  • Click Yes to continue.

Read more about deletion and usage check

If a Global Listener is deleted by mistake, it can be restored form the Recycle Bin

Filter

A text filter is available at the top of the list of Global Listeners; to filter on the available listeners, simply write the wanted letter combination to start filtering on the list.

Listener Ordering

The Listener Ordering allows the user to organize the order in which the Listeners are executed, this is done at the bottom of the Global Listeners view.

Global Listener Ordering

The following buttons are available:

ButtonCommentMore information
EditOpens Listener Ordering in edit-mode. Selecting a listener allows to move it up/down by clicking the blue arrows in the right side of the list of Global Listeners; remember to Save ordering to preserve the changes, click Continue in the save prompt or Cancel to omit the changes.
HistoryLists the history and versions created each time the Listener Ordering is saved, comments added at save are displayed here. View a previous version by selecting it in the History window. Set a previous version as stable by selecting it and clicking Set Stable in the top right corner of the History window. Restore a previous version by clicking Restore in the top right corner of the History window.History
Set/Unset Stable *Set the current version of the Global Listener Ordering as stable or unset itVersion flag

* It is compulsory to set a version of the Listener Ordering to stable when using the Version flag feature of Teneo Studio.

Details

Pre and Post Listeners

There are two types of Global Listeners and the difference between the two is the execution order:

  • Global Pre Listeners: these are run before the user input is tested against triggers, so if the user input matches a Global Pre Listener, the Listener's execution script is executed immediately before any Flow is triggered
  • Global Post Listener: Post Listeners are executed after a Flow is triggered

This means that when wanting to do something before a Flow is triggered, one should use Global Pre Listeners, while Global Post Listeners should be used for those tasks which are performed after the user input has triggered a Flow.

Sentence test order

This section currently only apply toTeneo Studio Desktop

The order which Teneo Engine follows when looking for a match in a multi-sentence user input can be determined by the Teneo user by modifying the Test sentence from option available at the bottom of the Global Listener's window.

Select First to last if Engine should start testing at the first sentence and work forward, or leave the default Last to first if Engine should test the last sentence first and move backwards.

Limit unused words

This section currently only apply toTeneo Studio Desktop

The Limit unused words setting allows to limit the number of unused words present in the user input, meaning that the Teneo user can specify a maximum number of words which the user input may contain beside those matching the TLML syntax for the match to be satisfied.

To set the Limit unused words simply tick the box and write the number of accepted unused words (or use the up/down arrows).

Stop after

This section currently only apply toTeneo Studio Desktop

In normal operations, the Teneo Engine stops testing sentences and user inputs once a match is found, but the Stop after setting for Global Listeners allows to modify this behavior providing the following options:

  • First match (Default): testing is stopped when a match is found
  • All sentences tested: the TLML Syntax of the Global Listener is tested against all the sentences in the user input creating an array of results
  • Current sentences tested (only Post-Listeners): the TLML Syntax of the Global Listener attempts to match against the most recent syntax (the previous trigger or input consuming transition).