Sample Code:
<aura:component implements=”lightningsnapin:prechatUI” controller=”PreChatController”>
If you are using Site, then do the below steps.
1. Go to the Site.
2. Click Public Access Settings.
3. Add the Apex Class to the Apex Class Access.
1. Go to Builder.
2. Go to Settings.
3. Go to General and open the Community Profile.