Newer Version Available
Set Up and Customize an Automated Invitation
Before you write any code, set up your invitation and Snap-ins deployment in Setup. From Salesforce Classic Setup, enter Chat Buttons in the Quick Find box, then select Chat Buttons & Invitations. Connect the invitation to the Live Agent deployment that you plan to use for your Snap-ins deployment. Then create or edit a Snap-ins deployment and select the Live Agent deployment and invitation for your Live Agent Settings.
- The position and animation don’t apply to customers using a mobile browser. They see the invitation above the snap-in with the “fade” animation type.
- Custom animations aren’t supported.
- The same fields that aren’t supported for Snap-ins chat buttons aren’t supported for Snap-ins invitations: Pre-Chat Form Page, Pre-Chat Form URL, Custom Chat Page, Invitation Image, and Site for Resources.
- You can’t use invitations with the Snap-ins component in your Community.
When you have an invitation in your deployment and a 4.0 code snippet, there’s a section of the code snippet that begins with <!-- Invitations - Static HTML/CSS/JS -->. This is where you define some behavior for the invitation and add your own HTML and CSS (if you want to).
- Wrap the HTML properly: <div id=”snapins_invite></div>. The <div> must also have a CSS property of visibility: hidden to ensure that the animations and rules work as you specified in Setup.
- We generate the default HTML and CSS for you when you add an invitation to your Snap-ins deployment and regenerate the snippet. The default invitation uses the font, primary color, and secondary color that you selected in Snap-ins setup.
- When you set an avatar image (set by defining embedded_svc.settings.avatarImgURL in your code snippet), the image appears in the top left of the invitation with the default HTML and CSS.
- embedded_svc.inviteAPI.inviteButton.acceptInvite()
- embedded_svc.inviteAPI.inviteButton.rejectInvite()
- embedded_svc.inviteAPI.inviteButton.setCustomVariable()
Automated Invitation Code Example
The following code example shows the default HTML, CSS, and JavaScript functions in the code snippet. This code is included in your version 4.0 and later code snippet when you add an invitation to a Snap-ins deployment and regenerate the code snippet.