Teneo Developers

Global Scripts


The Global Scripts are managed in the backstage of Teneo Studio and they include two script "levels": Session Scripts and Engine Scripts, both are described further in the below Script types section. The scripting language in Teneo Studio is Groovy, and Teneo Studio provides basic support for syntax highlighting.

View of Global Scripts

Global Script window








Script Ordering


Script types

The Global Scripts are divided between Session Scripts and Engine Scripts:

The Session Scripts all have read and write access to session data, read-only access to solution data and are connected to and occur within the scope of a session, on top of this, with Session Scripts it is possible to control and manipulate the input processing.
The Engine Scripts, on the other hand, have read and write access to solution data and are not connected to nor have access to any particular session.

The Session Scripts and Engine Scripts include different types of scripts, which are all presented in the below table. For each of the different scripts types it is possible to add one or more scripts which are then executed in the order defined by the user in the Script Ordering.

Script levelScript typeComment
Session ScriptBegin dialogBeing dialog scripts are executed at session start and are the very first first global scripts to execute when an end-user talks to the solution.
Session ScriptNew sessionNew session scripts run following the Begin dialog scripts, subsequent to the beginning of a new session started by a new user. If the session was started by a user whose session was timed out, the Timed-out session scripts are run instead.
Session ScriptTimed-out sessionThese scripts run when an end-user, whose session timed out, resumes the dialogue with the AI application. Usually, a session times out after 10 minutes of inactivity.
Session ScriptPre-processingPre-processing scripts run on each transaction before a sentence in a user input is separated for processing (before simplification). In these scripts, a user input can be manipulated before the input and dialogue processing begin and before Engine tests it against Flow triggers or transitions. A more common use of the Pre-processing scripts is to access other elements of the incoming http request than the user input string.
Session ScriptPre-matchingThese scripts execute before matching, but after the input is separated into words (after sentence segmentation and tokenization).
Session ScriptPost-processingThe Post-processing scripts are executed after the Engine has created a response (Output answer), but before the response is given to the end-user. The scripts allow to change the response data, i.e. Output text, Emotion and Output parameters.
Session ScriptEnd dialogThe End dialog scripts execute once, at the end of each session/dialogue.
Session ScriptPre-loggingThe Pre-logging scripts allow for (partial) access to the dialogue history through engineAccess and are executed after a session has completed and after the End dialog scripts, but before the data is written to logs. The Pre-logging scripts allow to modify content fields, for example, input/output text, input/output parameter values and Variable values, and enables the removal of data which should not be logged.
Session ScriptOn topThe On top scripts are executed whenever a Flow reaches the top of the flow stack (either by being triggered or by regaining the top position after being interrupted by the triggering of another Flow).
Session ScriptOn dropThese scripts execute when a Flow is dropped (finished or "stuck").
Engine ScriptSolution loadedThe Solution loaded scripts execute subsequent to loading of the solution; they usually contain definitions of utility functions that are called from other script locations. General scripting functionalities are usually written in Solution loaded scripts.
Engine ScriptSolution unloadedThe Solution unloaded scripts run once directly before the solution is unloaded.