Class

Conversation

Conversation()

A conversation

Constructor

# new Conversation()

Properties:
Name Type Description
conversationId uuid

the conversation id

dialogs Object

all of the dialogs on this conversation

mainDialog Dialog

the main dialog of this conversation

View Source conversation/conversation.js, line 64

Members

string

# accountId

The accountId of this connection, also known as "brand id"

View Source conversation/conversation.js, line 155

string

# appInstId

Installation identifier of a connector, server should fill that in case conversation is created by a connector

View Source conversation/conversation.js, line 218

Participant | null

# assignedAgent

Gets the assigned agent. Returns null if none assigned or conversation is closed.

View Source conversation/conversation.js, line 1198

number

# campaignId

Brands can have multiple campaigns aimed at specific target audiences. There can be various engagements within each campaign and they can be displayed based on visitor behavior and location on the website.

View Source conversation/conversation.js, line 212

object

# clientProperties

Details of the client that initiated the conversation

View Source conversation/conversation.js, line 235

Participant | null

# consumer

Gets the consumer. Returns null if none assigned or conversation is closed.

View Source conversation/conversation.js, line 1212

object

# context

Describes the conversation environment, like where from it was created and by whom

View Source conversation/conversation.js, line 231

number

# csat

Consumer satisfaction rate. Given by the consumer after the conversation is closed.

View Source conversation/conversation.js, line 201

string

# groupId

Add agent groupId for each conv. should be updated when agent assign/un assign

View Source conversation/conversation.js, line 173

string

# handlerAccountId

In regular conversation flow both roles are fulfilled by the same account - the brand. With the Conversation Rollover functionality, however, a conversation that belongs to a brand, might be handled by a Conversation Handler account e.g. Answering service This property describe an account that currently handles the conversation.

View Source conversation/conversation.js, line 225

string

# note

Notes about the conversation written by the agent during the conversation. Updates to this field will be permitted in CLOSE state, but not in LOCKED state.

View Source conversation/conversation.js, line 206

# notificationCount

the total number of notifications processed for this conversation

View Source conversation/conversation.js, line 89

# notificationIgnoredCount

the total number of notifications ignored due to no hash change

View Source conversation/conversation.js, line 91

# notificationOutOfOrderCount

the total number of notifications ignored due being received out of order

View Source conversation/conversation.js, line 93

object

# numberOfunreadMessages

Number of unread messages per participant. object {userId, # of unread messages}

View Source conversation/conversation.js, line 197

number

# startTime

The start time of the conversation in milliseconds from jan 1 1970

View Source conversation/conversation.js, line 159

number

# ttrEffective

Till when the agent must respond to consumer message. May be null. Takes into account values from ttr, delay, manualETTR fields during calculation

View Source conversation/conversation.js, line 178

number

# ttrEffectiveManual

ttr set manually by agent

View Source conversation/conversation.js, line 182

string

# ttrType

The type of the time to response e.g. NORMAL, PRIORITIZED

View Source conversation/conversation.js, line 186

number

# ttrValue

Seconds from consumer input till agent response.

View Source conversation/conversation.js, line 190

Methods

# async consumerTakeover(newConsumerUserId) → {Promise.<void>}

Allows a consumer to take over a conversation. Required after the step up process

Parameters:
Name Type Description
newConsumerUserId

View Source conversation/conversation.js, line 900

Promise.<void>

# getDialog(type)

Get the last updated dialog matching the type passed in

Parameters:
Name Type Description
type DialogType

the dialog type to match on

View Source conversation/conversation.js, line 779

# async join(participantRole) → {Promise.<void>}

Attempt to join the open dialog as the given role

Parameters:
Name Type Description
participantRole ParticipantRole

View Source conversation/conversation.js, line 1286

Promise.<void>

# async leave() → {Promise.<void>}

Attempt to leave the open dialog

View Source conversation/conversation.js, line 1295

Promise.<void>

# processStateNotification(state)

Takes a state notification and updates this conversation Will emit events if data has changed

Parameters:
Name Type Description
state

View Source conversation/conversation.js, line 544

# async queryMessages(queryopt)

Returns all messages from this dialog, optionally accepts a query to filter.

Parameters:
Name Type Attributes Description
query object <optional>

optional query to filter messages

maxQuantity string <optional>

maximum number of messages to return

sequenceMin string <optional>

messages older than the provided sequence number, inclusive

sequenceMax string <optional>

messages newer than the provided sequence number, inclusive

View Source conversation/conversation.js, line 1309

# async sendMessage(text, metadataopt, quickRepliesopt) → {Promise.<void>}

Sends a message to the open dialog in the conversation

Parameters:
Name Type Attributes Default Description
text string

Message text, max length 8,000 characters

metadata Object | Array.<Object> <optional>
null

A metadata object or an array of metadata objects, must conform to valid metadata schema

quickReplies Object <optional>
null

An object conforming to the quick replies schema

View Source conversation/conversation.js, line 1234

Promise.<void>

# async sendPrivateMessage(text, metadataopt) → {Promise.<void>}

Sends a private message on the open dialog, only agents and agent managers can see these messages

Parameters:
Name Type Attributes Default Description
text string

Message text, max length 8,000 characters

metadata Object | Array.<Object> <optional>
null

A metadata object or an array of metadata objects, must conform to valid metadata schema

View Source conversation/conversation.js, line 1246

Promise.<void>

# async sendRichText(message, metadataopt, quickRepliesopt) → {Promise.<void>}

Sends a structured content on the open dialog

Parameters:
Name Type Attributes Default Description
message Object

Structured content or rich text, max length 15,000 characters

metadata Object | Array.<Object> <optional>
null

A metadata object or an array of metadata objects, must conform to valid metadata schema

quickReplies Object <optional>
null

An object conforming to the quick replies schema

View Source conversation/conversation.js, line 1259

Promise.<void>

# async setAgentNote(noteContent, agentIdopt, nameopt, noteIdopt, isAutoSummaryopt, truncateEnabledopt) → {Promise.<{truncated: boolean, truncatedText: string}>}

Updates the conversation's note field, retaining existing notes

Parameters:
Name Type Attributes Description
noteContent string

The note text

agentId string | null <optional>

Agent ID. If null, defaults to the userId of the connection

name string | null <optional>

Agent name. If null, defaults to the agent name of the connection

noteId string | null <optional>

agentId::timeInMs

isAutoSummary boolean <optional>

Indicates if the note is an automated summarization

truncateEnabled boolean <optional>

Defaults to true where notes with more than 5000 characters will be truncated

View Source conversation/conversation.js, line 958

  • No room left to add agent note
Error
  • If truncated is true, truncatedText is the noteContent after truncation
Promise.<{truncated: boolean, truncatedText: string}>

# async setCsat(csatRate, csatResolutionConfirmation, csatStatusopt) → {Promise.<void>}

Updates csatRate

Parameters:
Name Type Attributes Default Description
csatRate string
csatResolutionConfirmation boolean
csatStatus CsatStatus <optional>
csatStatus.FILLED

View Source conversation/conversation.js, line 1123

Promise.<void>

# async setManualETTR(time) → {Promise.<void>}

Sets the manual time to respond for the conversation, only supported for brand connections

Parameters:
Name Type Description
time Number

time to respond in timestamp format

View Source conversation/conversation.js, line 1155

Promise.<void>

# async setNote()

Deprecated:
  • Replaced by setAgentNote

View Source conversation/conversation.js, line 943

# async setTTR(ttrType, valueopt) → {Promise.<void>}

Sets TTR for the conversation

Parameters:
Name Type Attributes Default Description
ttrType TTRType
value Number <optional>
0

TTR value in seconds. This value is only updatable when ttrType is CUSTOM. For all other types, the value is assigned by the system.

View Source conversation/conversation.js, line 1146

Promise.<void>

# async transfer(argsopt)

Transfers the conversation to another agent, skill, or both. Removes the ASSIGNED_AGENT from the conversation.

Parameters:
Name Type Attributes Description
args object <optional>

Object containing agentId or skillId. Defaults to an empty Object

agentId string <optional>

Transfers this conversation to the specified agentId

skillId string <optional>

Transfers this conversation to the specified skillId

View Source conversation/conversation.js, line 878

void

# unload()

Unloads this conversation from memory, only works on a previously deserialized conversation that was loaded with connection.loadConversation

View Source conversation/conversation.js, line 806

# async uploadFile(buffer, captionopt) → {Promise.<void>}

Refer to this documentation to enable file sharing. Uploads a file and publishes the upload event on the open dialog

Parameters:
Name Type Attributes Description
buffer ArrayBuffer

buffer of the file to be uploaded

caption string <optional>

a caption for the file

View Source conversation/conversation.js, line 1272

Promise.<void>

Events

# dialog:close

Dialog has closed

Parameters:
Name Type Description
dialogState object
state string

the current dialog state

metaDataLastUpdateTs number

the timestamp of that time the dialog was updated

participantDetails Array

a collection of the participants joined on the dialog

View Source conversation/dialog.js, line 236

# back-to-queue

The conversation was sent back to queue. This happens when an assigned agent is removed, there is no new assigned agent to replace them, and there was not a skill change

View Source conversation/dialog.js, line 304

# close

Conversation has closed

View Source conversation/conversation.js, line 291

# consumer-step-up

Consumer has been removed and then replaced with a different userId, indicating a consumer step-up event.

View Source conversation/dialog.js, line 319

# dialog

New dialog on the conversation

Parameters:
Name Type Description
dialog Dialog

View Source conversation/conversation.js, line 728

# group-change

Agent group changed for the conversation

Parameters:
Name Type Description
groupInfo object
prevGroupId string

old groupId

newGroupId string

new groupId

View Source conversation/conversation.js, line 274

# manual-ettr-change

Agent changed the time to respond for the conversation

Parameters:
Name Type Description
manualEttrChange object
ttrEffectiveManual number

time to respond in timestamp

ttrEffective number

time to respond in timestamp

View Source conversation/conversation.js, line 302

# message

New message arrived

Parameters:
Name Type Description
message Message

the new message

View Source conversation/dialog.js, line 870

# participant-added

An active participant was added to the dialog

Parameters:
Name Type Description
addedParticipant object
participant Participant

the participant added

context object

the context in which the participant was added

context.previouslySuggested boolean

the participant went from the state 'suggested' to 'active'

View Source conversation/dialog.js, line 259

# participant-removed

An active participant was removed from the dialog

Parameters:
Name Type Description
participant Participant

the participant removed

View Source conversation/dialog.js, line 294

# participant-suggested

A participant was added to the dialog with a state of 'suggested'

Parameters:
Name Type Description
participant Participant

the participant suggested

View Source conversation/dialog.js, line 273

# participant-suggested-removed

A participant with the state of 'suggested' was removed from the dialog

Parameters:
Name Type Description
participant Participant

the participant removed

View Source conversation/dialog.js, line 330

# transfer-agent

The conversation was transferred to a new agent. This happens when an agent is added with a state of 'suggested'

Parameters:
Name Type Description
participant Participant

the agent transferred to

View Source conversation/dialog.js, line 283

# transfer-skill

The skill has changed and previous agent is unassigned, indicating a skill transfer

Parameters:
Name Type Description
skillTransfer object
skillId string

the skillId transferred to

View Source conversation/dialog.js, line 345

# ttr-change

Consumer changed the time to respond for the conversation

Parameters:
Name Type Description
ttrChange object
ttrValue number

time to respond in seconds

ttrType string

the type of time to respond e.g. PRIORITIZED

ttrEffective number

time to respond in timestamp

View Source conversation/conversation.js, line 318