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))
ParameterTypeDescription
optionsObject

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

PropertyTypeDescription
pageNumber

Optional

The page of conversations that you want returned.

pageSizeNumber

Optional

The page size that you want returned. The default is 100.

callbackResponse

PropertyTypeDescription
conversationsArray

Required

A list of conversation objects. See conversations below for details.

pagesObject

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

The following table shows you what each object looks like in the conversations array.

PropertyTypeDescription
conversationIdString

Required

The unique identifier for the conversation.

createdAtString

Required

The time the conversation was created.

previewString

Required

Preview text for the conversation.

isInAssistantModeBoolean

Optional

Tells you whether the conversation is currently in assistant mode or not

lastMessageAtString

Required

The time of the last message in the conversation.

endedBoolean

Optional

Tells you whether the conversation has been ended or not.