Newer Version Available

This content describes an older version of this product. View Latest

Response Bodies for Live Agent REST API

A request to a Live Agent REST API resource returns a response code. The successful execution of a resource request can also return a response body in JSON format.

Availability

Response Properties
Property Name Type Description Available Versions
results Array of Result objects A list of Salesforce IDs that correspond to agents and chat buttons and their respective availability to receive new chat requests. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-0", "9");{
2"results":{
3            "type":"array",
4            "description":"List of ids and their availability",
5            "items":{
6               "name":"result",
7               "type":"object",
8               "properties":{
9                   "id":{
10                       "type":"string",
11                       "description":"The id of the entity",
12                       "required":true,
13                       "version":29.0
14                   },
15                   "isAvailable":{
16                       "type":"boolean",
17                       "description":"Whether or not the entity is available for chat",
18                       "required":true,
19                       "version":29.0
20                   }
21               }
22            },
23            "required":true,
24            "version":29.0
25        }
26}

ChasitorSessionData

Response Properties
Property Name Type Description Available Versions
queuePosition integer The position of the chat visitor in the chat queue. 29.0
geoLocation GeoLocation object The chat visitor's location, based on the IP address from which the request originated. 29.0
url String The URL that the chat visitor is visiting. 29.0
oref String The original URL that the chat request came from. 29.0
postChatUrl String The URL to which to redirect the chat visitor after the chat has ended. 29.0
sneakPeekEnabled Boolean Whether Sneak Peek is enabled for the agent who accepts the chat. 29.0
chatMessages Array of TranscriptEntry objects The chat message structure that’s synchronized across the agent.js and chasitor.js files. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-1", "9");{
2        queuePosition: 1,
3        geoLocation: {
4                countryCode: "US",
5                countryName: "United States of America",
6                region: "CA",
7                city: "San Francisco",
8                organization: Salesforce.com,
9                latitude: 37.793880,
10                longitude: -122.395114
11        },
12        url: "http://yoursite",
13        oref: "http://www.google.com?q=yoursite",
14        postChatUrl: "http://yoursite/postchat",
15        sneakPeekEnabled: true,
16        chatMessages: [
17                {
18                        type: "Agent",
19                        name: "Andy L.",
20                        content: "Hello, how can I help you?",
21                        timestamp: 1376596367548,
22                        sequence: 1
23                },
24                {
25                        type: "Chasitor",
26                        name: "Jon A.",
27                        content: "I have a question for you.",
28                        timestamp: 1376596349132
29                        sequence: 2
30                }
31        ]
32}

ChatEstablished

Response properties
Property Name Type Description Available Versions
name String The name of the agent who is engaged in the chat. 29.0
userId String The user ID of the agent who is engaged in the chat. 29.0
sneakPeekEnabled Boolean Whether Sneak Peek is enabled for the agent who accepts the chat. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-2", "9");{
2        name: "Andy L.",
3        userId: "f1dda237-57f8-4816-b8e8-59775f1e44c8",
4        sneakPeekEnabled: true
5}

ChatMessage

Response properties
Property Name Type Description Available Versions
name String The name of the agent who is engaged in the chat. 29.0
text String The text of the chat message that the agent sent to the chat visitor. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-3", "9");{
2        name: "Andy L."
3        text: "Hello, how can I help you?"
4}

ChatRequestFail

Response properties
Property Name Type Description Available Versions
reason String The reason why the chat request failed—for example, no agents were available to chat or an internal error occurred. 29.0
postChatUrl String The URL of the post-chat page to which to redirect the chat visitor after the chat has ended. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-4", "9");{
2        reason: "Unavailable",
3        postChatUrl: "http://yoursite/postChat"
4}

ChatRequestSuccess

Response properties
Property Name Type Description Available Versions
queuePosition integer The position of the chat visitor in the chat queue. 29.0
geoLocation GeoLocation object The chat visitor's location, based on the IP address from which the request originated. 29.0
url String The URL that the chat visitor is visiting. 29.0
oref String The original URL that the chat request came from. 29.0
postChatUrl String The URL to which to redirect the chat visitor after the chat has ended. 29.0
customDetails Array of CustomDetail objects The custom details of the deployment from which the chat request was initiated. 29.0
visitorId String The ID of the chat visitor. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-5", "9");"{
2        queuePosition: 1,
3        geoLocation: {
4                countryCode:"US",
5                countryName: "United States of America",
6                region: "CA",
7                city: "San Francisco",
8                organization: Salesforce.com,
9                latitude: 37.793880,
10                longitude: -122.395114
11        },
12        url: "http://yoursite",
13        oref: "http://www.google.com?q=yoursite",
14        postChatUrl: "http://yoursite/postchat",
15        customDetails: [
16                {
17                        label: "E-mail Address",
18                        value: "jon@example.com",
19                        transcriptFields: [
20                                 "c__EmailAddress"
21                         ],
22                        displayToAgent: true
23                }                        
24
25        ],
26        visitorId: "acd47048-bd80-476e-aa33-741bd5cb05d3"
27}"

ChatTransferred

Response properties
Property Name Type Description Available Versions
name String The name of the agent to whom the chat was transferred. 29.0
userId String The ID of the chat visitor. 29.0
sneakPeekEnabled Boolean Whether Sneak Peek is enabled for the agent to whom the chat was transferred. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-6", "9");{
2        name: "Ryan S.",
3        userId: "edacfa56-b203-43d5-9e1b-678278b61263",
4        sneakPeekEnabled: false
5}

CustomEvent

Response properties
Property Name Type Description Available Versions
type String The type of custom event that occurred, used for adding the event listener on the chat visitor’s side. 29.0
data String Data that’s relevant to the event that was sent to the chat visitor. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-7", "9");{
2        type: "CreditCardEntered",
3        data: "5105105105105100"
4}

Messages

Response Properties
Property Name Type Description Available Versions
messages Array of Message objects The messages that was sent over the course of a chat. 29.0
sequence integer The sequence of the message as it was received over the course of a chat. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-8", "9");{
2        messages: [
3                {
4                        type: "ChatEstablished",
5                        message: {
6                                name: "Andy L.",
7                                userId: "f1dda237-57f8-4816-b8e8-59775f1e44c8",
8                                sneakPeekEnabled: true
9                        }
10                }
11        ],
12        sequence: 1
13}

NewVisitorBreadcrumb

Response properties
Property Name Type Description Available Versions
location String The URL of the Web page that the chat visitor is viewing. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-9", "9");{
2        location: "http://yoursite/page2"
3}

QueueUpdate

Response properties
Property Name Type Description Available Versions
position integer The updated position of the chat visitor in the chat queue. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-10", "9");{
2        position: 3
3}

ResyncSession

Response properties
Property Name Type Description Available Versions
isValid Boolean Indicates whether the session is valid (true) or not (false). 29.0
key String The session key for the new session after the old session has been reestablished. 29.0
affinityToken String The affinity token for the session that’s passed in the header for all future requests. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-11", "9");{
2        isValid: true,
3        key: "dd19849c-26df-4e21-b4cf-3aada410f35d",
4        affinityToken: "73061fa0"
5}

SessionId

Response Properties
Property Name Type Description Available Versions
id String The session ID for the new session. 29.0
key String The session key for the new session. 29.0
affinityToken String The affinity token for the session that’s passed in the header for all future requests. 29.0
clientPollTimeout integer The number of seconds before you must make a Messages request before your Messages long polling loop times out and is terminated. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-12", "9");{
2        id: "241590f5-2e59-44b5-af89-9cae83bb6947",
3        key: 
4        "f6c1d699-84c7-473f-b194-abf4bf7cccf8!b65b13c7-f597-4dd2-aa3a-cbe01e69f19c",
5        affinityToken: "73061fa0"
6        clientPollTimeout: "30"
7}

Settings

Response Properties
Property Name Type Description Available Versions
pingrate number The rate at which the visitor must ping the server to maintain the Live Agent visitor session. 29.0
contentServerUrl String The URL of the content server. 29.0
buttons Array of button objects A list of chat buttons, along with their settings information, that were specified when you made the Settings request. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-13", "9");{
2        "pingRate":{
3            "type":"number",
4            "description":"The rate at which the visitor should ping the server to maintain presence",
5            "required":true,
6            "version":29.0
7        },
8        "contentServerUrl":{
9            "type":"string",
10            "description":"The content server URL",
11            "required":true,
12            "version":29.0
13        },
14        "buttons":{
15            "type":"array",
16            "description":"The list of buttons",
17            "items":{
18               "name":"button",
19               "type":"object",
20               "properties":{
21                   "id":{
22                       "type":"string",
23                       "description":"The id of the button",
24                       "required":true,
25                       "version":29.0
26                   },
27                   "type":{
28                       "type":"string",
29                       "description":"The type of the button",
30                       "required":true,
31                       "version":29.0,
32                       "enum":["Standard","Invite","ToAgent"]
33                   },
34                   "endpointUrl":{
35                       "type":"string",
36                       "description":"The custom chat window url of the button",
37                       "required":false,
38                       "version":29.0
39                   },
40                   "prechatUrl":{
41                       "type":"string",
42                       "description":"The prechat url of the button",
43                       "required":false,
44                       "version":29.0
45                   },
46                   "language":{
47                       "type":"string",
48                       "description":"The language setting of the button",
49                       "required":false,
50                       "version":29.0
51                   },
52                   "isAvailable":{
53                       "type":"boolean",
54                       "description":"Whether or not the button is available for chat",
55                       "required":true,
56                       "version":29.0
57                   },
58                   /* Invite related settings */
59                   "inviteImageUrl":{
60                       "type":"string",
61                       "description":"The image of the button",
62                       "required":false,
63                       "version":29.0
64                   },
65                   "inviteImageWidth":{
66                       "type":"number",
67                       "description":"The width of the button image",
68                       "required":false,
69                       "version":29.0
70                   },
71                   "inviteImageHeight":{
72                       "type":"number",
73                       "description":"The height of the button image",
74                       "required":false,
75                       "version":29.0
76                   },
77                   "inviteRenderer":{
78                       "type":"string",
79                       "description":"The animation option of the invite",
80                       "required":false,
81                       "version":29.0,
82                       "enum":["Slide","Fade","Appear","Custom"]
83                   },
84                   "inviteStartPosition":{
85                       "type":"string",
86                       "description":"The start position of the animation",
87                       "required":false,
88                       "version":29.0,
89                       "enum":["TopLeft","TopLeftTop","Top","TopRightTop","TopRight",
90                               "TopRightRight","Right","BottomRightRight","BottomRight",
91                               "BottomRightBottom","Bottom","BottomLeftBottom","BottomLeft",
92                               "BottomLeftLeft","Left","TopLeftLeft"]
93                   },
94                   "inviteEndPosition":{
95                       "type":"string",
96                       "description":"The end position of the animation",
97                       "required":false,
98                       "version":29.0,
99                       "enum":["TopLeft","Top","TopRight","Left","Center","Right","BottomLeft","Bottom","BottomRight"]
100                   },
101                   "hasInviteAfterAccept":{
102                       "type":"boolean",
103                       "description":"Whether or not invite will trigger after accepting",
104                       "required":false,
105                       "version":29.0
106                   },
107                   "hasInviteAfterReject":{
108                       "type":"boolean",
109                       "description":"Whether or not invite will trigger after rejecting",
110                       "required":false,
111                       "version":29.0
112                   },
113                   "inviteRejectTime":{
114                       "type":"number",
115                       "description":"The auto reject setting of the invite",
116                       "required":false,
117                       "version":29.0
118                   },
119                   "inviteRules":{
120                       "type":"object",
121                       "description":"The rules of the invite",
122                       "required":false,
123                       "version":29.0
124                   }
125                   /* Invite related settings */
126               }
127            },
128            "required":true,
129            "version":29.0
130        }
131    }

VisitorId

Response Properties
Property Name Type Description Available Versions
sessionId String The session ID for the new session. 29.0
Response body
1swfobject.registerObject("clippy.codeblock-14", "9");"sessionId":{
2            "type":"string",
3            "description":"The session id of the visitor",
4            "required":true,
5            "version":29.0
6        }