Back to Blog

How To Add Business Hours To Your Chatbot

When designing your chatbot you might encounter the fact that your business processes are different outside of business hours. A common example is a livechat takeover by a human during business hours. Outside of business hours you might want to get contact details of the end user to get back to them asap.

Set Business Hours

You can set your Business Hours by selecting Business Hours from the Project Settings. You will be asked to enter a Label, Timezone, Channel and your opening hours.

image

Conditions or Actions

From here we got two options. You can either use conditions if you feel more confortable with the drag & drop interface or you could you Actions if you prefer Javascript.

Conditions

Conditions in combination with Business Hours can be used to alter the chatbot flow based on your business hours. Use conditions or if/else statements, and branch your chatbot. If it its within opening hours we can follow up with a live agent. Else, we create a ticket to follow up with a CRM system.

Conditions for Business Hours Chatbot

Actions

After setting your business hours, you can also branch your bot by using Actions. Actions are small pieces of JavaScript that you can run within a Flow. The example below triggers the event “Livechat Open” if it is within Business Hours and triggers the event “Livechat Closed” otherwise. Change the label to your own label and modify the triggered event to your needs.

After you’ve created your action don’t forget to implement it in your design. Within your flows drag en drop an Action reply and select the action you’ve just created.

async payload => {

 if(await toolbelt.isBusinessHours({
   label: "YourLabel"
 })) {
   trigger('Livechat Open')
 }
 else{
   trigger('Livechat Closed')
 }
}
Get StartedContact us