Configure the escalation to human based on days and times

Case study of the use of conditions on date variables native to Botnation

We will take the case of a customer service where the advisers are available from Monday to Friday from 9am to 12pm and from 2pm to 6pm.

The chatbot should therefore only offer the escalation to the human (connecting with a chat advisor in the chatbot) when they are present.

The user must also be given an alternative way to contact customer service. In this example we will choose to send an email.

We will imagine that the chatbot has a menu with a “Contact Us” button.

When the user clicks on this button, the chatbot must check the availability of the advisors. This is possible with conditions on the Botnation date and time variables.

We need 4 sequences:

  • Menu
  • Checking availability
  • Climbing towards the human
  • Send email

The “Contact us” button in the Menu sequence will redirect to the “Check availability” sequence.

To achieve this, we will focus on the periods of non-availability of advisors. All the conditions that we are going to set up, will aim to determine when the chatbot must propose the sending of emails. And if the day and time do not meet any of these conditions, then the consultants are available and the escalation to the human should be offered.

First of all, at the beginning of the sequence, the “Availability” variable must be reset. Otherwise it will keep its previous value when it is run again on this sequence.

For the verification of the day we will use the variable {{bn_date_Wday}} which assigns a number from 1 to 7 to each day of the week (1 = Sunday, 2 = Monday… 7 = Saturday).

So the chatbot needs to redirect the user to send email for days 1 and 7.

This results in the following conditions:

  • If the variable “bn_date_day” = 1 OR If the variable “bn_date_day” = 7 Then the variable “Availability” will take the value “No”.

When creating these conditions, you will have to create the variable bn_date_day but as it is a Botnation variable, it takes its value automatically.

To check the time we will use another native variable {{bn_date_hour}} which gives the time as a number from 0 to 24.

The first set of conditions will check if the time is before 9AM or after 6PM. In these time slots, the advisors are not available, so the user will be redirected to the email.

This results in the following conditions:

  • If the variable “bn_date_hour” < 9 OR If the variable “bn_date_hour” ≥ 18 Then the variable “Disponibility” will take the value “No”

It’s good ≥ 18 because from 18H to 18h59, “bn_date_hour” keeps the value 18
When creating these conditions, as with the bn_date_day variable, you will need to create the bn_date_hour variable.

Please note:

In this example, we have taken the system variable bn_date_local_hour: it takes into account the chatbot’s time zone rather than the user’s. We recommend it when the schedule should not change depending on the user’s location. For example, if your office hours are based on Paris time but you have clients in South America.

To learn more, we invite you to read the dedicated article.

Now you have to check if the time is not between 12 and 2 pm. Note that in this time range from 12 to 13:59, “bn_date_hour” must be greater than or equal to 12 and less than 14.

This translates into the following condition:

  • If the variable “bn_date_hour” ≥12 AND If the variable “bn_date_hour” <14 Then the variable “Disponibility” will take the value “No”

In the end, if none of the above conditions have been met, then the consultants are available at that time.

Finally, we use a condition on the “Availability” variable to guide the user according to the availability of a consultant: IF a consultant is not free (CAD when the “Availability” variable is set to “No”) THEN we redirect him to a sequence on which he can leave a message OR we redirect it to the climbing sequence.

The “Contact us” button will send you to the chat with the consultants according to their availability.

Create your Chatbot Easily and for Free!