KustomerCore.getConversations()
Fetches the conversations in history
First, initialize chat
You must initialize with
KustomerCore.init()
before you can execute any additional Core SDK methods
Examples
// Get conversations
KustomerCore.getConversations();
// Get conversations with a callback
KustomerCore.getConversations({}, function (res, error) {
console.log('Fetched conversations!', res.conversations);
});
Syntax
KustomerCore.getConversations(options, function(callbackResponse, error))
Parameter | Type | Description |
---|---|---|
options | Object | Optional These options allow you to configure the page and page size of the response. |
function(callbackResponse, error) | Function | Optional A callback that is run after KustomerCore.getConversations() completes.callbackResponse is an object returned to the callback function. See the callbackResponse section below to see the properties of the object.error is either undefined or a native JavaScript Error object. |
options
options
Property | Type | Description |
---|---|---|
page | Number | Optional The page of conversations that you want returned. |
pageSize | Number | Optional The page size that you want returned. The default is 100. |
callbackResponse
callbackResponse
Property | Type | Description |
---|---|---|
conversations | Array | Required A list of conversation objects. See conversations below for details. |
pages | Object | Required This is an object giving details about the page you are on, that looks like this: { current: Number, first: Number, next: Number, previous: Number } |
conversations
conversations
The following table shows you what each object looks like in the conversations
array.
Property | Type | Description |
---|---|---|
conversationId | String | Required The unique identifier for the conversation. |
createdAt | String | Required The time the conversation was created. |
preview | String | Required Preview text for the conversation. |
isInAssistantMode | Boolean | Optional Tells you whether the conversation is currently in assistant mode or not |
lastMessageAt | String | Required The time of the last message in the conversation. |
ended | Boolean | Optional Tells you whether the conversation has been ended or not. |
Updated almost 4 years ago