Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
getDetailsByChatKey()
Syntax
1sforce.console.chat.getDetailsByChatKey(chatKey:String, callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| chatKey | String | The chatKey associated with the chat for which to retrieve details. |
| callback | function | JavaScript 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:
| Name | Type | Description |
|---|---|---|
| primaryTabId | String | The ID of the primary tab associated with the chat. |
| details | Object | An object that contains all the details for a chat associated with a particular primary tab. |
| success | Boolean | true if retrieving the details was successful; false if retrieving the details wasn’t successful. |
details
The details object contains the following properties:
| Property | Type | Description |
|---|---|---|
| acceptTime | Date/Time | The date and time an agent accepted the chat request. |
| breadcrumbs | Array of breadcrumb objects | An array of breadcrumb objects representing a list of Web pages visited by the visitor before and during the chat. |
| chatKey | String | The chat key associated with the chat. |
| customDetails | Array of customDetail objects | An 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. |
| geoLocation | Object | An object representing the details of a chat visitor’s location, derived from a geoIP lookup on the chat visitor's IP address. |
| ipAddress | String | The IP address of the chat visitor in dot-decimal format. |
| isEnded | Boolean | Specifies whether a chat has ended (true) or not (false). |
| isEngaged | Boolean | Specifies whether a chat is currently engaged (true) or not (false). |
| isPushRequest | Boolean | Specifies 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). |
| isTransferringOut | Boolean | Specifies whether a chat is currently in the process of being transferred to another agent (true) or not (false). |
| liveChatButtonId | String | The 15-digit record ID for the chat button from which the chat request originated. |
| liveChatDeploymentId | String | The 15-digit record ID for the deployment from which the chat request originated. |
| name | String | The name of the chat visitor. |
| requestTime | Date/Time | The date and time the chat was requested. |
| visitorInfo | Object | An 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:
| Property | Type | Description |
|---|---|---|
| location | String | The URL of a Web page viewed by a chat visitor. |
| time | Date/Time | The 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:
| Property | Type | Description |
|---|---|---|
| label | String | The name of the custom detail as specified in the Deployment API or Pre-Chat Form API. |
| value | String | The value of the custom detail as specified in the Deployment API or Pre-Chat Form API. |
| transcriptFields | Array of Strings | The names of fields where the customer’s details on the chat transcript are saved. |
| entityMaps | Array of entityMap objects | An 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:
| Property | Type | Description |
|---|---|---|
| entityName | String | The record to search for or create. |
| fieldName | String | The name of the field associated with the details. |
| isFastFillable | Boolean | Specifies 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). |
| isAutoQueryable | Boolean | If 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. |
| isExactMatchable | Boolean | Specifies 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:
| Property | Type | Description |
|---|---|---|
| city | String | The name of the chat visitor’s city. |
| countryCode | String | The two-digit ISO-3166 country code for the chat visitor's country. |
| countryName | String | The name of chat visitor’s country. |
| latitude | String | The chat visitor's approximate latitude. |
| longitude | String | The chat visitor's approximate longitude. |
| organization | String | The organization name of the chat visitor's internet service provider. |
| region | String | The 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:
| Property | Type | Description |
|---|---|---|
| browserName | String | The name and version of the chat visitor's web browser. |
| language | String | The language of the chat visitor's web browser. |
| originalReferrer | String | The original URL of the Web page from which the chat visitor requested a chat. |
| screenResolution | String | The screen resolution of the chat visitor's computer, as passed by the chat visitor’s browser. |
| sessionKey | String | the sessionKey of the visitor which will ultimately be stored on the LiveChatVisitor record as a unique reference to this live chat visitor |