Skip to main content

Unified Service Desk & Cafex - Enabling Chat

Hi Friends,

Sharing my learning. Lets get to the point.

Refer Cafex provisioning steps

This blog is to enable chat capability for our customer portal or website.


Step 1: Copy snippet from Live Assist Admin Portal
-          Go to Account Administration Portal. URL can be found in the below mentioned “Chat Setting” record under Settings - > Live Assist -> Settings



-          In the portal, go to Get Started -> Chat

      Then click next button

-          Copy the snippet

The snippet will look as follows,
<script type="text/javascript">(function(a){function b(B,C){let D=new c(B,C);document.dispatchEvent(D)}function c(B,C){let D;if('function'==typeof window.CustomEvent)D=new CustomEvent(B,C);else{let E=C||{bubbles:!1,cancelable:!1,detail:void 0};D=document.createEvent('CustomEvent'),D.initCustomEvent(B,E.bubbles,E.cancelable,E.detail)}return D}function d(){var B=document.querySelectorAll('[data-event]');B.forEach(function(C){let D=JSON.parse(C.dataset.event);f(D,!0)})}function f(B,C){let D=document.getElementById(B.id);(B.oneTime||C)&&(D.disabled=!0,'undefined'!=typeof B.disabledStyle&&(D.style.cssText=B.disabledStyle),D.style.cssText+='pointer-events: none;')}function g(B){o(sessionStorage,B,'element already exists in local storage list',z)}function h(){let B=JSON.parse(sessionStorage.getItem(z)),C=[];for(let D in B)B[D].oneTime&&C.push(k(B[D]));0!==C.length&&j(C)}function j(B){let C=document.head||document.getElementsByTagName('head')[0],D=document.createElement('style');D.type='text/css',B.forEach(function(E){D.appendChild(document.createTextNode(E))}),C.appendChild(D)}function k(B){let C='#'+B.id+'{',D=B.disabledStyle.split(';');return D.forEach(function(E){C+=E+' !important;'}),C+='pointer-events: none;',C+='}',C}function l(B,C){let D={detail:{data:C}};if(B){let E=JSON.parse(C).id,F=document.querySelectorAll('[data-boot-strap]');for(let H,G=F.length-1;0<G;G--)if(H=F[G].dataset.bootStrap,JSON.parse(H).id===E){D={detail:{data:H}};break}}return D}function m(B){o(localStorage,B,'script already exists in local storage list',y)}function o(B,C,D,E){let F=JSON.parse(B.getItem(E));F||(F={}),F[C.id]===void 0?(F[C.id]=C,B.setItem(E,JSON.stringify(F)),console.log('adding'+C.id+' to storage')):console.log(D)}function p(B){q(localStorage,B,y)}function q(B,C,D){let E=JSON.parse(B.getItem(D));!1==delete E[C]&&console.log('script'+C+'does not exist in list'),B.setItem(D,JSON.stringify(E))}function r(B){let C=document.getElementById(B);C&&(C.parentNode.removeChild(C),C=null,console.log('script'+B+' removed from dom'))}function .....
.....
.....
</script>

Note: The snippet differs from environment to environment and it is basically a <Script> tag of type Java Script.
Step 3: Paste the snippet to the customer portal/websites header tag. Once it is done, refresh your website to see that chat widget.

Thanks,
Naveen.

Comments