Flow Designs: Set Business Hours

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 the hours when you are open.

Conditions or Actions

You can either use conditions if you feel more comfortable with the drag and drop interface or you could you Actions if you prefer using JavaScript.

Conditions

You can use Conditions in combination with Business Hours 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, you can follow up with a live agent. Or, you can create a ticket to follow up with a CRM system.

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')  
 }  
}