Build a Proactive Chatbot with Prompt Triggers

Conversational agents are becoming more intelligent and user-friendly thanks to growing skill sets of conversational developers and to more enabling conversational AI platforms. Teneo platform provides the tools necessary to build intelligent and conversational bots. We have covered some of the features in the platform in previous articles, such as Handling Disambiguation, Handling Topic Switching, and Multi-Intent Recognition… etc. In this article, we talk about a distinctive feature in Teneo, namely, Prompt Triggers.

What is a Prompt Trigger in a Teneo Solution?

A Prompt Trigger is a feature in Teneo which developers can use to make the virtual agent more proactive in a conversational manner. It may be used to provide suggestions related to a certain topic that the user brings up, or a campaign relevant during certain period of time, for instance.

How Do Prompt Triggers Work?

In your conversational bot, Intent Triggers are deployed and depending on the match requirements of each intent trigger, it is determined which flow should be triggered, given user input (also known as user intent).

Prompt Triggers, on the other hand, hold a script condition that decides whether a prompt flow should be triggered or not.

  • They do not use user input or user intent as match requirements; they use script expressions to trigger the prompt flows when the condition is met.
  • They are considered for execution only when the flow stack is empty, in other words, when there isn’t any active flow in the conversation.
  • Same as intent triggers, prompt triggers are placed in order. They have their own trigger ordering group and are evaluated according to their order in that group.

What is in a Prompt Flow?

A prompt flow is similar to an intent flow. The distinctive component is the triggering part. As displayed in the image below, in a prompt flow the trigger has an expression field; this expression determines whether the flow is to be activated or not.


The expression in the prompt trigger is evaluated whenever no other flow is active on the flow stack. This expression field is used to specify the conditions under which the flow can be activated. Such as:

  • A certain value of a global variable.
  • A certain flow is completed or completed a certain number of times.
  • A certain date or period in time …etc.

Additionally, in the prompt trigger panel, you define the order group of that trigger, the number of times this trigger can be matched in one session, and any relevant Metadata tags. Prompt triggers have their own trigger ordering groups, and they do not interfere with the Intent Triggers .

Other than the different Trigger type, a prompt flow can have all types of nodes that an intent flow has.

Multiple Triggers in One Flow! Why?

Some flows inside your solution may be triggered by different means in the conversation. This is made possible when you create multiple triggers for a flow; a main intent trigger, a keyword trigger, a prompt trigger …etc.

For example:

  • User makes a direct request that matches the intent trigger requirements of that flow.

  • User sends in keywords that match the keyword trigger of a flow.

  • SafetyNet counts reach a predefined limit.

The image below is an example of a live-chat handover flow that has two trigger types: an intent trigger, and a prompt trigger. The prompt trigger expression evaluates to True when the value of the variable SafetyNetCounter is equal to 5. In this case, when the user requests have hit the SafetyNet too many times, then live-agent handover will be prompted.

Use-Case Scenarios for Prompt Trigger Implementations

In this section we will see some examples of prompt trigger implementations. The first example is a promotion or a campaign that runs in the current month.

Time-bound Promotion

When you create a solution in Teneo you will have some built-in resources such as Global Scripts, Global Contexts, Global Variables…etc. Part of the Begin Dialogue Global Script returns values for current month, day, and year. These values are stored in Global Variables in the solution. We use the Lib_iMonth Global Variable value in the expression of the prompt trigger to match if the current month is November for our example. This example is shown in the image below.

Prompt trigger expression is:

Lib_iMonth == 11

This expression can as well be modified to trigger on a specific hour. As seen in the image below, this prompt trigger is matched if the time is 4 o’clock in the afternoon. The prompt trigger expression is as follows.

// get the hour of the day

def currentHour =

// is it cookie hour?

(currentHour == 16)


Topic in Discussion

The next example is a prompt trigger matched on certain information obtained during the conversation. A Global Variable sCurrentTopic=”” can be set, and its value can be changed to different topics depending on the activated flows. For instance, if the user is talking about booking flights, then the book a flight flow is triggered, and the current topic can be set to “book flight” or “flight”. The value of this Global variable can be used to prompt promotions or commercial information relevant to that topic. In the image below, you can see how the global variable value is set in the relevant flows to match the discussed topic. Then a prompt flow is created to send information to the user that is pertinent to the context of the discussion. Keep in mind that prompt triggers are only considered when the flow stack is empty; this way the flight booking flow will not be interrupted. Once the flight booking process is completed, and the flow stack is empty again, then the matching prompt trigger will be activated.

Collect User Feedback in Defined Places

The example below is a prompt flow used to collect user feedback and is activated by matching a value of a global variable.

The global variable in this example has a Boolean value initiated as false and is changed to true in a flow On Drop script. This means that each time this flow is done the user will be asked to leave his/her feedback about the bot performance.

The prompt trigger expression matches only if the global variable is true:

bReadyForFeedback == true

The On Drop flow script can be added to all relevant flows to change the value of the global variable and, therefore, activate the prompt flow:

if (bReadyForFeedback != 'done')
{bReadyForFeedback = true}

The image below displays the example and the logic implemented.


Prompt triggers are used to make the bot act proactively using contextual information relevant to the conversation with the user. The expression of a prompt trigger is the matching criteria, and it can be evaluated against different components in the solution, such as, global variables, global contexts, and global scripts. Prompt triggers are not evaluated against user input. Instead, they are based on programmatic logic used to ensure proactive bot performance. Have you started working with prompt triggers yet? Share with us in the comments some of the use-case scenarios for your prompt triggers.

1 Like