function CreateWhatsappChatWidget(option = { brandSetting: { autoShow: true, backgroundColor: "#0a6114", borderRadius: "25", brandImg: "https://cdn.clare.ai/wati/images/WATI_logo_square_2.png", brandImgData: null, brandName: "WATI", brandSubTitle: "Typically replies within a day", ctaText: "Start Chat", welcomeText: "Hi, there! \nHow can I help you?", messageText: "", phoneNumber: "85252859384" }, chatButtonSetting: { backgroundColor: "#4dc247", borderRadius: "25", ctaText: "", marginLeft: "0", marginRight: "20", marginBottom: "20", position: "right" }, enabled: false }) { if (option.enabled == false){ return; } if(!option.chatButtonSetting.position){ option.chatButtonSetting.position = "right"; option.chatButtonSetting.marginBottom = "20"; option.chatButtonSetting.marginLeft = "0"; option.chatButtonSetting.marginRight = "20"; } var css = document.createElement("STYLE"); if(window.jQuery){ initWidget(); }else{ var script = document.createElement("SCRIPT"); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; script.type = 'text/javascript'; script.onload = function() { initWidget(); }; document.getElementsByTagName("head")[0].appendChild(script); } function initWidget(){ if (option.brandSetting.messageText) { option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("{{page_link}}", encodeURIComponent(window.location.href)); option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("__page_link__", encodeURIComponent(window.location.href)); option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("{{page_title}}", window.document.title); option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("__page_title__", window.document.title); option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("\n", "%0A"); } jQuery('body').append(`