Newer Version Available
Get Settings from the Embedded Service Code Snippet
Get settings for use with your Embedded Service Aura components. You can get the Chat
button ID or deployment ID assigned to your Embedded Service deployment and the agent and
chatbot avatar image URLs.
Use the Aura method getLiveAgentSettings() to grab the settings that you want to use: liveAgentButtonId, liveAgentDeploymentId, chatbotAvatarImgURL, avatarImgURL.
This example shows you how to use the lightningsnapin:settingsAPI component with a
custom pre-chat component. The pre-chat component uses different fields and a CSS
class when a specific Chat button is used with the chat window.
Before you start, make sure that you have an Embedded Service deployment already set up. You should also have a working Embedded Service Aura component before you make any changes based on the Embedded Service deployment settings.
To get started, go to the Developer Console and open one of your Embedded Service Aura components.
-
Add a line in your component markup file to create the settings API
component.
-
In your init handler, use the Aura method getLiveAgentSettings() to grab the settings you
want.
This example customizes the First Name and Last Name fields when a certain Chat button is used by the current chat window by:
- Pre-populating the visitor's name as "Anonymous Visitor"
- Making the fields read-only
- Adding a CSS class called anonymousField
-
In your component CSS file, add a CSS rule for our new
anonymousField CSS class.
- Save your component.