3.3 - Building triggers

We're moving now to one of the most important components of your call flow - triggers. We already gave a short introduction to triggers in this article but now we are getting serious. You will learn how to create your own triggers and make use of them.

Introduction to triggers - recap

Triggers describe a certain condition. They don't do anything on their own but you need them to route your calls.

For instance, in the call flow we are building together now, we will have four triggers:

  1. It checks if business hours are not true. So if a call reaches the platform after hours it returns TRUE.
  2. It checks if a calendar is true. So if you entered an exceptional holiday and a call reaches the platform at that time, it will also return TRUE.
  3. It looks if there are any agents logged-in to take calls. If there are it also returns TRUE.
  4. It checks the queue wait time (how long has the customer been waiting in the queue).

So that's what we do with triggers: we define conditions and based on whether or not they are true, a call takes a certain route in your call flow. Triggers are only useful if you combine them with modules or events. But you cannot build a call flow without them.

Let's look at how triggers work and what you can do with them.

Creating triggers

To create a new trigger go to the Triggers tab and then click on the 'Add' button in the upper right corner of the screen. Give your trigger a name and then choose the logic type - you can choose between:

'Match ALL conditions' - every single condition you define in this trigger will have to be met for the trigger to run.

and

'Match ANY conditions' - at least one condition you define in this trigger will have to be met for the trigger to run.

trigger_1.png

Once you're ready, click the 'Add condition' button. You will see a window with 3 components of your condition:

  • Expression
  • Operator
  • (in most cases) an Expectation

⇒ Expressions

Expressions are probably a bit difficult to understand at first - but they are crucial. For almost any functionality you have an expression that will be filled with a value at some point within a call.

You have a wide choice of expressions to use. For instance, each Business Hour and Calendar has its own expression (open the drop-down list to check them). This also means that expressions can be dynamic, the more business hours you have the more business hour expressions you will see. E.g., if you have one Business Hour for your New York City and another for your Amsterdam office, you might find the following two expressions in the list:

    • Business Hours [Office Hours - US/NYC]
    • Business Hours [Office Hours - EU/Amsterdam]

trigger_2.png

Other examples of dynamic expressions - calendars, queues, variables, and IVR inputs.

Besides those, you have a number of pre-defined expressions, mainly concerning calls and agents. You find them all in your Expression drop-down list.

⇒ Operators

Next, to define a trigger, you must create some logical condition with the help of Operators. So for instance, you want the caller reaching your platform after-hours to hear an after-hour announcement. Therefore, you need to check whether Business Hours do not apply. This is what the Operator is doing. As you will see in the example below, you can select the operator "is not given" to define this condition. Alternatively, you could use  "is equal to" ("operator") "false" ("expectation") or "is not equal to" "true". There are many ways of achieving and testing this condition.

This is the list of all currently available logical Operators:

      • is equal to
      • is not equal to
      • is great than
      • is great than or equal to
      • is less than
      • is less than or equal to
      • matches
      • is similar to
      • is given
      • is not given
      • is evaluable
      • is not evaluable
      • is null
      • is not null
      • starts with
      • ends with
      • contains
      • does not contain 

Additionally, here's a more detailed overview that includes the type of operator. Remember, if it says "unary", no input in "Expectation" is needed.

{ 
"items": [
{
"name": "CONTAINS",
"label": "contains",
"code": "triggers.operator.CONTAINS.label",
"type": "binary"
},
{ "name": "NOT_CONTAINS",
"label": "does not contain",
"code": "triggers.operator.NOT_CONTAINS.label",
"type": "binary"
},
{ "name": "ENDS_WITH",
"label": "ends with",
"code": "triggers.operator.ENDS_WITH.label",
"type": "binary"
},
{
"name": "EQ",
"label": "is equal to",
"code": "triggers.operator.EQ.label",
"type": "binary"
},
{
"name": "EVALUABLE",
"label": "is evaluable",
"code": "triggers.operator.EVALUABLE.label",
"type": "unary"
},
{
"name": "GIVEN",
"label": "is given",
"code": "triggers.operator.GIVEN.label",
"type": "unary"
},
{
"name": "GT",
"label": "is greater than",
"code": "triggers.operator.GT.label",
"type": "binary"
},
{
"name": "GE",
"label": "is greater than or equal to",
"code": "triggers.operator.GE.label",
"type": "binary"
},
{
"name": "LT",
"label": "is less than",
"code": "triggers.operator.LT.label",
"type": "binary"
},
{
"name": "LE",
"label": "is less than or equal to",
"code": "triggers.operator.LE.label",
"type": "binary"
},
{
"name": "NEQ",
"label": "is not equal to",
"code": "triggers.operator.NEQ.label",
"type": "binary"
},
{
"name": "NOT_EVALUABLE",
"label": "is not evaluable",
"code": "triggers.operator.NOT_EVALUABLE.label",
"type": "unary"
},
{
"name": "NOT_GIVEN",
"label": "is not given",
"code": "triggers.operator.NOT_GIVEN.label",
"type": "unary"
},
{
"name": "IS_NOT_NULL",
"label": "is not null",
"code": "triggers.operator.IS_NOT_NULL.label",
"type": "unary"
},
{
"name": "IS_NULL",
"label": "is null",
"code": "triggers.operator.IS_NULL.label",
"type": "unary"
},
{
"name": "LIKE",
"label": "is similar to",
"code": "triggers.operator.LIKE.label",
"type": "binary"
},
{
"name": "REGEXP",
"label": "matches",
"code": "triggers.operator.REGEXP.label",
"type": "binary"
},
{
"name": "STARTS_WITH",
"label": "starts with",
"code": "triggers.operator.STARTS_WITH.label",
"type": "binary"
}
]

Setting up the 4 triggers for our test call-flow

The first trigger we already discussed extensively in this tutorial: it checks whether Business Hours do not apply. If you want to reuse the existing trigger, you must exchange the business hours it refers to! So click on the down-pointing error, find "Date and Time" and select the correct Business Hours that you want to use from the list. If you see numbers next to the 'Date and time' you have selected an obsolete business hour and the trigger will not be working.

trigger_3.png

The second trigger is looking at holidays. It's similar to the trigger for Business Hours: go into Expressions, find Date and Time and select the calendar you want to use.

trigger_4.png

The third trigger is checking if agents are enabled. Enabled means that at least one agent is online. However, this does not mean an agent is ready to take a call. This one agent might be busy in a call. You can find the right expression under Queue Data.

trigger_5.png

The fourth trigger checks how long a call has been waiting in a queue. If it waits more than 5 minutes = 300000 milliseconds, the trigger is true. You will find the right Expression under Queue Data.

trigger_6.png

Need an additional explanation? Check our step-by-step video guide:

In the next section, you will learn how these conditions that triggers create can be used to define a call's path.

Have more questions? Submit a request