Class

Dialog

Dialog()

A dialog from a conversation

Constructor

# new Dialog()

View Source conversation/dialog.js, line 53

Members

# assignedAgent

The assigned agent (or null if none assigned)

View Source conversation/dialog.js, line 99

# consumer

The consumer

View Source conversation/dialog.js, line 109

Methods

# static deserialize(conversation, state) → {Dialog}

Rehydrate a serialized dialog

Parameters:
Name Type Description
conversation
state

View Source conversation/dialog.js, line 756

Dialog

# async close(dialogCloseReason, cause) → {Promise.<void>}

Close the dialog, conversation will remain open.

Parameters:
Name Type Description
dialogCloseReason DialogCloseReason

"AGENT", "CONSUMER", or "SYSTEM"

cause string

View Source conversation/dialog.js, line 523

Promise.<void>

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

Retrieve and process all PublishEvents for this dialog: ContentEvent, RichContentEvent & AcceptStatusEvent. This should be called to ensure that all the messages for a dialog have been populated.

View Source conversation/dialog.js, line 732

Promise.<void>

# getSelfParticipant() → {Participant|null}

Gets the Participant object that corresponds with the current connection if it exists. Returns null otherwise.

View Source conversation/dialog.js, line 361

Participant | null

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

Attempt to join the current dialog as the given role

Parameters:
Name Type Description
participantRole ParticipantRole

View Source conversation/dialog.js, line 550

Promise.<void>

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

Attempt to leave the current dialog

View Source conversation/dialog.js, line 558

Promise.<void>

# async queryMessages(queryopt) → {Promise.<Array.<Message>>}

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/dialog.js, line 679

messages matching the query

Promise.<Array.<Message>>

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

Sends an accept status for all publish events in the sequence list

Parameters:
Name Type Description
sequenceList Array

array of sequence numbers to send the accept status

View Source conversation/dialog.js, line 635

Promise.<void>

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

Sends a message on this dialog

Parameters:
Name Type Attributes Default Description
text string

the text of the message, 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/dialog.js, line 582

Promise.<void>

# async sendPrivateMessage(text, metadataopt)

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

Parameters:
Name Type Attributes Default Description
text string

the text of the message, max length 8,000 characters

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

An array of metadata entries, these must conform to a valid metadata schema

View Source conversation/dialog.js, line 614

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

Sends a read status for all publish events in the sequence list

Parameters:
Name Type Description
sequenceList Array

array of sequence numbers to send the read status

View Source conversation/dialog.js, line 649

Promise.<void>

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

Sends a rich text message on this dialog

Parameters:
Name Type Attributes Default Description
message string

the text of the message, max length 15,000 characters

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

An array of metadata entries, these must conform to a valid metadata schema

quickReplies Object null

an object conforming to the quick replies schema

View Source conversation/dialog.js, line 626

Promise.<void>

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

Sets the chat state for a participant in the dialog

Parameters:
Name Type Description
chatState ParticipantChatState

The current chat state for the dialog participant

View Source conversation/dialog.js, line 664

Promise.<void>

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

Uploads a buffer and publishes the upload event on this dialog

Parameters:
Name Type Attributes Description
buffer ArrayBuffer

buffer of file to be uploaded

caption string <optional>

a caption for the file

View Source conversation/dialog.js, line 596

Promise.<void>