Overview
You can add a script to the website to control when different chats appear after normally scheduled on-call hours.
Who uses this feature
Administrators, Office Employees
Applies to all business types
Example coding to configure dates and times
The following is an example of coding for Podium or ST Chat to Text and Scheduling Pro. The days/times are configured for when the Scheduling Pro chat will appear:
Example: Day 1 - Monday
In this example Day 1 - Monday, SP Chat will appear before 07:00 and after 18:00. The week starts with Day 0 - Sunday.
In the bottom section that controls the Podium Chat, insert the Podium API key. The SP chat will appear for the times listed and all other times the Podium chat will appear.
<script>
var hour_of_day = new Date().getHours();
var day_of_week = new Date().getDay();
if (day_of_week == 0 ||
day_of_week == 1 && hour_of_day <= 7 ||
day_of_week == 1 && hour_of_day >= 18 ||
day_of_week == 2 && hour_of_day <= 7 ||
day_of_week == 2 && hour_of_day >= 18 ||
day_of_week == 3 && hour_of_day <= 7 ||
day_of_week == 3 && hour_of_day >= 18 ||
day_of_week == 4 && hour_of_day <= 7 ||
day_of_week == 4 && hour_of_day >= 18 ||
day_of_week == 5 && hour_of_day <= 7 ||
day_of_week == 5 && hour_of_day >= 18 ||
day_of_week == 6) {
WebChat.loadChat({ apiKey: 'insertchatkey', primaryAccentColor: '#888888', autoOpen: true, autoOpenMobile: false, mobileHeightPercentage: 75, autoOpenExpiration: 1, title: 'Hi and welcome to Company Name, what can I help you with today?', initialMessage: [] });
}
else {
var script = document.createElement('script');
script.src = "https://connect.podium.com/widget.js#API_TOKEN=podiumtoken";
script.id = 'podium-widget';
script.type = 'text/javascript';
script.setAttribute('data-api-token', "podiumtoken");
document.getElementsByTagName('body')[0].appendChild(script);
}
</script>
This is the example coding for Service Titan Chat to Text and Schedule Engine. The days/times are configured for when the SP chat will appear.
In this example for Day 1 - Monday, SP Chat will appear before 07:00 and after 18:00. In the bottom section that controls the ST Chat widget, insert the SP Chat to text Code.
The SP chat will appear for the times listed and all other times the ST chat will appear.
<script>
var hour_of_day = new Date().getHours();
var day_of_week = new Date().getDay();
if (day_of_week == 0 ||
day_of_week == 1 && hour_of_day <= 7 ||
day_of_week == 1 && hour_of_day >= 18 ||
day_of_week == 2 && hour_of_day <= 7 ||
day_of_week == 2 && hour_of_day >= 18 ||
day_of_week == 3 && hour_of_day <= 7 ||
day_of_week == 3 && hour_of_day >= 18 ||
day_of_week == 4 && hour_of_day <= 7 ||
day_of_week == 4 && hour_of_day >= 18 ||
day_of_week == 5 && hour_of_day <= 7 ||
day_of_week == 5 && hour_of_day >= 18 ||
day_of_week == 6) {
WebChat.loadChat({ apiKey: 'insertchatkey', primaryAccentColor: '#888888', autoOpen: true, autoOpenMobile: false, mobileHeightPercentage: 75, autoOpenExpiration: 1, title: 'Hi and welcome to Company Name, what can I help you with today?', initialMessage: [] });
}
else {(function(q,w,e,r,t,y,u){q[t]=q[t]||function(){(q[t].q = q[t].q || []).push(arguments)};
q[t].l=1*new Date();y=w.createElement(e);u=w.getElementsByTagName(e)[0];y.async=true;
y.src=r;u.parentNode.insertBefore(y,u);q[t]('init', 'xxxxxxxxxxxxxxxxxx');
})(window, document, 'script', 'https://static.servicetitan.com/text2chat/shim.js', 'T2CWidgetManager');t>