How to set the flow according to Open/Closed Business Hours

Do you want to direct your visitors to a determined flow according to the day and time they access the bot? Don't worry, we've got your back 😉

Import into your bot our Ready-to-use Brick, called Business Open/Closed v1

This is how it will look in your bot builder:

This is the body that comes by default in the Webhook, and you can edit it to your convenience at any time, according to the instructions of this article:

{
"timezone":"Europe/Madrid",
"closeddates":["2019-10-03","2019-12-24"],
"specialdateshours": {        
"2019-10-04": [["08:40:00", "10:00:00"]],        
"2019-10-23": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]]     
},
    "businesshours": {        
"0": null,        
"1": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]],        
"2": [["09:30:00", "17:00:00"]],        
"3": [["09:30:00", "13:00:00"]],        
"4": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"],["20:30:00", "23:42:00"]],
"5": [["07:30:00", "17:00:00"]],        
"6": null    
}
}

NOTE: Be careful with the punctuation, and always TEST the Webhook before you start using it.

Please adapt the following elements to your specific use case:

  1. TIMEZONE

Choose the Timezone applicable to your Business. Select your time zone from the this list.

Use the form like the example, as in Europe/Madrid , or America/Los_Angeles (...):

"timezone":"America/Los_Angeles",

  1. CLOSED DATES

If there are any closed dates, include it as in the following format:

"closeddates":["2019-10-03","2019-12-24"],

If there are no closed dates:

"closeddates":[],

  1. FORMAT

The format of the dates must always be like the following:

"2019-12-24" => YYYY-MM-DD

  1. SPECIAL DATES HOURS

Are there days with special hours? No problem, just edit it here.

   "specialdateshours": {        
"2019-10-04": [["08:40:00", "10:00:00"]],        
"2019-10-23": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]]     
},

If there is no Special dates hours

   "specialdateshours": {},

  1. BUSINESS HOURS

Here is where you edit your regular business hours.

Choose opening and closing times to each day. If there are breaks, use the format given in the example, creating a new time slot.

    "businesshours": {        
"0": null,        
"1": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]],        
"2": [["09:30:00", "17:00:00"]],        
"3": [["09:30:00", "13:00:00"]],        
"4": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]],
"5": [["07:30:00", "17:00:00"]],        
"6": null    
}

Days of the week

"0" = Sunday,        
"1" = Monday      
"2" = Tuesday,        
"3" = Wednesday,        
"4" = Thursday,
"5" = Friday        
"6" = Saturday

If there is a day of the week that is closed:

"0": null,

If there is a day where the schedule is divided in more than one part:

"4": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]],

Examples:

a) Los Angeles example

This schedule is for Business:

  • Located in Los Angeles timezone,
  • Has no special dates where the business is closed.
  • Has no days with special hours;
  • Has regular business hours from Monday to Friday, between 9:00 AM to 5:00 PM,
{
"timezone":"America/Los_Angeles",
"closeddates":[],
"specialdateshours": {},
    "businesshours": {        
"0": null,        
"1": [["09:30:00", "17:00:00"]],        
"2": [["09:30:00", "17:00:00"]],        
"3": [["09:30:00", "17:00:00"]],        
"4": [["09:30:00", "17:00:00"]],
"5": [["09:30:00", "17:00:00"]],        
"6": null    
}
}

b) Europe/Madrid example

This is schedule is for a Business:

  • Located in Madrid timezone;
  • Will be closed on 2019-10-03 and 2019-12-24;
  • Has special date hours on 2019-10-04 and 2019-10-23.
  • Has Business hours from Monday to Friday, with different times and breaks.
  {
"timezone":"Europe/Madrid",
"closeddates":["2019-10-03","2019-12-24"],
"specialdateshours": {
"2019-10-04": [["08:40:00", "10:00:00"]],
"2019-10-23": [["09:30:00", "17:00:00"],["18:30:00", "19:00:00"]]
},
"businesshours": {
"0": null,
"1": [["09:30:00", "17:00:00"],["18:20:00", "19:00:00"]],
"2": [["09:30:00", "18:30:00"]],
"3": [["09:30:00", "13:00:00"]],
"4": [["09:30:00", "18:00:00"],["18:30:00", "19:00:00"],
"5": [["07:30:00", "17:00:00"]],
"6": null
}
}

  1. SAVE THE RESPONSE

Save the response as a variable, in the format of String .

  1. Outside the Brick, connect the Outputs Open or Close to the correct flows.

How did we do?

Contact