Salesforce Live Agent Destination
To get started, follow Salesforce’s instructions to create a live agent deployment. If you have already done this, navigate to the “deployment code” of the Live Agent deployment you would like to have Segment integrate with. It will look something like this:
When you enable Salesforce Live Agent in Segment, we’ll begin loading the Salesforce Live Agent web SDK on any pages you have Segment deployed. Their accompanying API functionality will be available to interact with however, we will not initialize their API automatically. This is because their API has two core functions:
- Control the visual configuration of the chat experience (set the size of the chat window, conditionally display buttons based on whether the chat agent is online/offline, etc.)
- Send data about the
Contactto your chat agent as well as your Salesforce CRM deployment using a pre-chat form
The latter functionality described above is what Segment integrates with. However, Salesforce’s API stipulates that you must define the data you want to send to your Agent/Salesforce instance before you initialize their SDK.
This presents a problem because this data is generally only available after some kind of form submission by the user. Because Segment has no way of knowing if the page the user is on will contain such a form submission, we cannot decide at page load whether we need to initialize the Live Agent SDK right away (to allow for chat window customization) or wait until sometime after page load (once the user has submitted the information you request).
In short, our integration cannot proactively initialize the Live Agent SDK on page load on your behalf. The specific instructions regarding initialization options are outlined below.
In order to begin using the Salesforce Live Agent using Segment, follow these implementation guidelines.
- On any page where you are not collecting user information, but do want to interact with the Salesforce Live Agent API (to achieve some of the functionality outlined here for example), you must implement all the Live Agent SDK functionality natively except the actual loading of their
- On any page where you are collecting user information (using some kind of pre-chat form for example) that you would like to pass to Salesforce and/or your chat agent after the user completes the form, you must ensure you do not call
liveagent.initnatively anywhere on the page and ensure that you do invoke a properly formatted Identify event, Group event (this is optional), and finally a Live Chat Conversation Started event in that order.
identify does not actually trigger any kind of corresponding functionality in Salesforce Live Agent. Instead, the traits you define in this event are cached in the browser and used anytime a
Live Chat Conversation Started event is invoked sometime in the future. You can map the traits you pass in to Salesforce
Contact fields, as well as information fields for your customer service agent to see in their chat console. These mappings are defined in the Contact Mappings destination setting.
Similar to calling
identify, invoking our
group method does not actually trigger any kind of corresponding functionality in Salesforce Live Agent. Instead, the traits you define in this event are cached in the browser and used anytime a Live Chat Conversation Started event is invoked sometime in the future. You can map these properties to Salesforce
Account fields, as well as information fields for your customer service agent to see in their chat console. These mappings are defined in the Account Mappings destination setting.
Live Chat Conversation Started
The Live Chat Conversation Started event is a
track event that is part of our Live Chat event spec. When invoked, Segment will begin looking for any cached user traits (from previous
identify events) as well as group traits (from previous
group events) and map them to Salesforce’s API based on the mappings you defined in your settings.
The properties that you pass into the
Live Chat Conversation Started event can also be mapped to a Salesforce
Case object. These mappings are defined in the Case Mappings destination setting.
Important: If you have defined mappings to Salesforce
Account objects in your settings, you must ensure that you have invoked an
identify event and/or a
group event sometime prior to invoking the
Live Chat Conversation Started event.
Deployment Code Settings
Many of the settings required to allow Segment to integrate with your Live Agent deployment are located in your Live Agent “deployment code” snippet. The following code snippet can be used to reference where you can find the values these settings require (setting names are capitalized):
This page was last modified: 10 Nov 2020
Questions? Problems? Need more info? Contact us, and we can help!