getDetailsByChatKey()

Returns the details of the chat associated with a specific chat key. Available in API version 29.0 or later.

Syntax 

1sforce.console.chat.getDetailsByChatKey(chatKey:String, callback:Function)

Arguments 

NameTypeDescription
chatKeyStringThe chatKey associated with the chat for which to retrieve details.
callbackfunctionJavaScript method called upon completion of the method.

Sample Code–Visualforce 

1<apex:page >
2    <apex:includeScript value="/support/console/68.0/integration.js"/>
3    <a href="#" onClick="testGetDetailsByChatKey();">Get Chat Details</a>
4
5    <script type="text/javascript">
6
7        function testGetDetailsByChatKey() {
8            //Get the value for 'myChatKey' from the sforce.console.chat.getDetailsByPrimaryTabId() or other chat methods.
9            //These values are for example purposes only
10            var chatKey = 'myChatKey';
11            sforce.console.chat.getDetailsByChatKey(chatKey, getDetailsSuccess);
12        }
13
14        function getDetailsSuccess(result) {
15            //Report whether accepting the chat was succesful
16            if (result.success == true) {
17                ipAddress = result.details.ipAddress;
18                alert('The Visitor IP Address for this chat is: ' + ipAddress);
19            } else {
20                alert('Getting the details was not successful');
21            }
22        };
23
24
25    </script>
26</apex:page>

Response 

This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following properties:

NameTypeDescription
primaryTabIdStringThe ID of the primary tab associated with the chat.
detailsObjectAn object that contains all the details for a chat associated with a particular primary tab.
successBooleantrue if retrieving the details was successful; false if retrieving the details wasn’t successful.

details 

The details object contains the following properties:

PropertyTypeDescription
acceptTimeDate/TimeThe date and time an agent accepted the chat request.
breadcrumbsArray of breadcrumb objectsAn array of breadcrumb objects representing a list of Web pages visited by the visitor before and during the chat.
chatKeyStringThe chat key associated with the chat.
customDetailsArray of customDetail objectsAn array of customDetail objects that represent custom details that have been passed in to this chat via the Deployment API or Pre-Chat Form API.
geoLocationObjectAn object representing the details of a chat visitor’s location, derived from a geoIP lookup on the chat visitor’s IP address.
ipAddressStringThe IP address of the chat visitor in dot-decimal format.
isEndedBooleanSpecifies whether a chat has ended (true) or not (false).
isEngagedBooleanSpecifies whether a chat is currently engaged (true) or not (false).
isPushRequestBooleanSpecifies whether a chat was routed to an agent through a push-based routing method such as Least Active or Most Available (true) or not (false).
isTransferringOutBooleanSpecifies whether a chat is currently in the process of being transferred to another agent (true) or not (false).
liveChatButtonIdStringThe 15-digit record ID for the chat button from which the chat request originated.
liveChatDeploymentIdStringThe 15-digit record ID for the deployment from which the chat request originated.
nameStringThe name of the chat visitor.
requestTimeDate/TimeThe date and time the chat was requested.
visitorInfoObjectAn object containing information about the visitor’s web browser.

breadcrumb 

A breadcrumb represents a Web page viewed by a chat visitor. The breadcrumb object contains the following properties:

PropertyTypeDescription
locationStringThe URL of a Web page viewed by a chat visitor.
timeDate/TimeThe date and time a chat visitor visited a specific breadcrumb URL.

customDetail 

Custom details are details have been passed into the chat through the Deployment API or Pre-Chat Form API. The customDetail object contains the following properties:

PropertyTypeDescription
labelStringThe name of the custom detail as specified in the Deployment API or Pre-Chat Form API.
valueStringThe value of the custom detail as specified in the Deployment API or Pre-Chat Form API.
transcriptFieldsArray of StringsThe names of fields where the customer’s details on the chat transcript are saved.
entityMapsArray of entityMap objectsAn array of pre-created records used for mapping custom detail information.

entityMap 

Entities are records that are created when a customer starts a chat with an agent. You can use the API to auto-populate these records with customer details. The entityMap object contains the following properties:

PropertyTypeDescription
entityNameStringThe record to search for or create.
fieldNameStringThe name of the field associated with the details.
isFastFillableBooleanSpecifies whether the value can be used to populate the field when an agent creates or edits a record (true) or not (false) (Live Agent console only).  
isAutoQueryableBooleanIf you’re using the Live Agent console, specifies whether to perform a a SOSL query (in the Live Agent console) (true) or not (false) to find records with a fieldName containing the value. If you’re using the Salesforce console, specifies whether to perform a SOQL query (in the Salesforce console) (true) or not (false) to find records with a fieldName containing the value.
isExactMatchableBooleanSpecifies whether to only search for records that have fields exactly matching the field fieldName (true) or not (false).

geoLocation 

The geoLocation object represents the details of a chat visitor’s location. It contains the following properties:

PropertyTypeDescription
cityStringThe name of the chat visitor’s city.
countryCodeStringThe two-digit ISO-3166 country code for the chat visitor’s country.
countryNameStringThe name of chat visitor’s country.
latitudeStringThe chat visitor’s approximate latitude.
longitudeStringThe chat visitor’s approximate longitude.
organizationStringThe organization name of the chat visitor’s internet service provider.
regionStringThe chat visitor’s region, such as state or province.

visitorInfo 

The visitorInfo object represents information about the visitor’s web browser. It contains the following properties:

PropertyTypeDescription
browserNameStringThe name and version of the chat visitor’s web browser.
languageStringThe language of the chat visitor’s web browser.
originalReferrerStringThe original URL of the Web page from which the chat visitor requested a chat.
screenResolutionStringThe screen resolution of the chat visitor’s computer, as passed by the chat visitor’s browser.
sessionKeyStringthe sessionKey of the visitor which will ultimately be stored on the LiveChatVisitor record as a unique reference to this live chat visitor