OLD BUILDER - How to change bot depending on business hours (open or closed/weekend)
We know that offer a personalize experience for our visitors is really important, and sometimes you might want to offer a different experience depending if your business is open or close, if you want to make the most of the Human Takeover, or let the user browse and let messages be answered after.
Scenario: You want to display a different bot if the business is open or closed.
With this in mind we can build 2 bots:
- A bot focused on attending customers in real time with the option to jump into the conversation with a potential client, or attending requests.
- Other bot focused in offering information, FAQs or capturing leads, that you will answer after.
For that what we are going to do is to use the following code, to embed in our sites, instead of the one given by default by Landbot:
To customize it to our needs, we need to edit the code as follows:
- We need to establish our GMT timezone, so that the bot works with your time zone, not the visitor time zone. In this case, for example if we are in Barcelona is GMT -1:00, therefore our const gmt has to be ["-",1,0]
const gmt = ["-", 1, 00]; //Examples: GMT-6:00 => ["-", 6, 0], GMT+1:00 => ["+", 1, 0], GMT-3:30 => ["-",3,30]
- Here we will write the time when the business is open, in this case will be local time, you don't need to change it for the time zone
const localOpenTimeWrkDays = [9,0]; //Examples: 09:00am => [9,0], 10:30am => [19, 30]
- As above, but this time for the closing time. If you close at 07:15 pm, will be [19,15]
const localClosingTimeWrkDays = [18,0]; //Examples: 06:00pm => [18,00], 19:30 => [19,30]
- In this line we will change the url between the " " , for he bot we want to be displayed during business hours
const landbotUrlBusinessOpen = "https://landbot.io/u/H-116518-LRMRPCEOUENE0LGK/index.html";
- As above we will change the url, but for the hours the business is closed
const landbotUrlBusinessClosed = "https://landbot.io/u/H-116690-O0PCPQYT66ACULA4/index.html";