Swapping 2 chatbots in the same page according to the time



Hello Everyone!

We are working on a project where we want a chatbot to have a different dialogue according to whether the dialogue is happening on business hours or not. Since collect.chat has a time-appearance setting, we wanted to add 2 chatbots to the same page, and make them appear and dissapear so that they dont bump onto each other. - this obviously didnt work, since the second bot always removed the former even if they are disabled -

Is there a way to achieve the result we are looking for in some other way?


Hi there,

The targeting settings apply to only one bot and if there are 2 bots on the same page, they will not work as you expected.

The result you wanted can be achieved using javascript code.

What you need to do is add the chatbot snippet code of one of the bots on the page. Ask your developer to write a timer function to conditionally load snippet of the new bot if the user’s time is in business hours. Basically, two bots will be in an if-else condition, so that either of these bots will be loaded based on the visitor’s time.

That should do the trick. The additional JS code must be on the same page.

I hope this helps!

Aslam from Collect.chat