ODA – Web SDK Widget Tips #2 – a different icon for every day of the week

ODA

One of my customers asked about the possibility of displaying different Chatbot Icon’s depending on the day of the week (only for Monday and Friday). That is actually quite easy to do and with the below code we can control it 🙂

The code goes in the settings.js of the Web SDK.

                //Note: Sunday is 0, Monday is 1, and so on.
		
                var d = new Date();
                var n = d.getDay();
		var icon = '';
		
		if(n==1){
				icon = './images/monday.png'
			}
		else if(n==5){
			icon = './images/friday.png'
		}
		else{
				icon = './images/default.png'
			}

And then

 var chatWidgetSettings = {
			 
			botButtonIcon: icon,
                        .....

That’s all it takes!