We will take the case of a customer service where the counselors are available from Monday to Friday from 9 a.m. to 12 p.m. then from 2 p.m. to 6 p.m.

The chatbot must therefore offer escalation to humans (chat with a counselor in the chatbot) only when they are present.

The user must also be given an alternative solution to contacting 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 counselors. This is possible with conditions on the botnation date and time variables.

We need 4 sequences:

  • Menu
  • Check availability
  • Escalation to human
  • Send email

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

To achieve our ends, we will focus on the periods of unavailability of advisers. All the conditions that we are going to put in place will therefore be aimed at determining when the chatbot should offer to send an email. And if the day and time do not meet any of these conditions, then the advisers are available and the human escalation must be offered.

First of all, at the start of the sequence, the "disponibility" variable must be reset. Otherwise it will keep its previous value during a new passage on this sequence.

To check 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). The chatbot must therefore 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 “disponibility” will take the value “No”

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

For the time check 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 9:00 a.m. or after 6:00 p.m. During these time slots, advisors are not available, so the user will be redirected to sending an 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"

This is ≥ 18 because from 6:00 p.m. to 6:59 p.m., “bn_date_hour” keeps the value 18 When creating these conditions, as for the bn_date_day variable, you will need to create the bn_date_hour variable.

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

Which results in the following condition:

  • IF the “bn_date_hour” variable ≥12 AND IF the “bn_date_hour” variable <14 THEN the “disponibility” variable will take the value “No”

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

Finally, a condition is used on the "disponibility" variable to guide the user according to the availability of an advisor: IF a counselor is not available (when the “disponibility” variable takes the value “No”) THEN we redirect him to a sequence on which he can leave a message ELSE we redirect him to the escalation sequence.


And there you have it, the “Contact us” button will indeed refer to the chat with the advisers according to their availability.



Related articles:

Did this answer your question?