function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bala Egambaram 9Bala Egambaram 9 

Live Chat Setup on Community Builder Page

Hi,
I am trying to implement Live Chat button in Napili Community Builder Home page.

I have lightning component with live chat deployment code in static resoureces as below:
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
    <ltng:require scripts="{!$Resource.TrailChat}" />
    <ltng:require scripts="{!$Resource.Deployment}" /> 
    <img id="liveagent_button_online_57341000000CzRV" style="display: none; border: 0px none; cursor: pointer"                           onclick="liveagent.startChat('57341000000CzRV')" src="https://bala-trailhead1-developer-edition.na35.force.com/resource/1481731369000/OnlineButton" />
    <img id="liveagent_button_offline_57341000000CzRV" style="display: none; border: 0px none; " src="https://bala-trailhead1-developer-edition.na35.force.com/resource/1481731401000/OfflineButton" />
</aura:component>

In the TrailChat.js file, I have below code:

liveagent.init('https://d.la2-c1-phx.salesforceliveagent.com/chat', '57241000000Cx1z', '00D41000001hJ6b');
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('57341000000CzRV', document.getElementById('liveagent_button_online_57341000000CzRV'));
liveagent.showWhenOffline('57341000000CzRV', document.getElementById('liveagent_button_offline_57341000000CzRV'));


I am getting following error if I add the lightning component in the Home or custom page in the community builder:

"Uncaught SyntaxError: Unexpected end of input throws at https://playful-bear-281399-dev-ed--livepreview.na35.force.com/sfsites/c/resource/1481921103000/TrailChat:4:114"

The same Live Chat code works fine in the classic Salesforce page.

Any help?

Thanks
Bala