Conversation

Encapsulates an active conversation between two parties.

Use this object to send system messages to the conversation or to programmatically select a conversation by passing it to Inbox.select.

Conversation objects are created with the deprecated Session.getOrStartConversation method.

Deprecated.

Properties

custom
CustomData
optional
Optional custom conversation meta data
id
string
The ID of the conversation
photoUrl
string
optional
An optional URL to a photo which will be shown as the photo for the conversation.
subject
string
optional
An optional conversation subject which is displayed in the chat header
topicId
string
Legacy - please use Conversation.subject instead.
welcomeMessages
Array<string>
optional

ConversationSelectedEvent

This represents the interface of the event triggered from Inbox.on_conversationSelected_

Properties

conversation
ConversationData | null
The current conversation object
me
User
The current TalkJS User
other
User
optional
The other praticipant in the conversation
others
Array<User>
optional
The other praticipants in the conversation

MessageField

Encapsulates the message entry field tied to the currently selected conversation.

Methods

focus

Focuses the message entry field. Note that on mobile devices, this will cause the on-screen keyboard to pop up, obscuring part of the screen.

setText

Sets the message entry field to text. Useful if you want to guide your user with message suggestions. If you want to start a UI with a given text showing immediately, consider passing InboxOptions.messageSuggestion to Session.createInbox (or createPopup or createChatbox).

Method Details

focus

messagefield.focus()
Focuses the message entry field. Note that on mobile devices, this will cause the on-screen keyboard to pop up, obscuring part of the screen.

Parameters

None.

Returns

void

setText

messagefield.setText(text)
Sets the message entry field to text. Useful if you want to guide your user with message suggestions. If you want to start a UI with a given text showing immediately, consider passing InboxOptions.messageSuggestion to Session.createInbox (or createPopup or createChatbox).

Parameters

text
string

Returns

void

SendMessageEvent

The event triggered when listening for the sendMessage event on the Inbox, Chatbox and Popup. This event is triggered before the message is sent to TalkJS, allowing you to modify the contents of the message or its metadata by using override().

Properties

conversation
ConversationData
The current conversation object

ConversationData

custom
CustomData
optional
Contains custom metadata for the conversation if it was set using ConversationBuilder.custom.
id
string
The ID of the conversation
photoUrl
string
optional
Contains the URL of a photo was set using ConversationBuilder.subject.
subject
string
optional
Contains the conversation subject if it was set using ConversationBuilder.subject.
topicId
string
optional

Deprecated. Please use ConversationBuilder.subject instead.

welcomeMessages
Array<string>
optional
One or more welcome messages that will display to the user as a SystemMessage
me
User
The current TalkJS user
message
SentMessage
The message that was sent

SentMessage

conversationId
string
The ID of the conversation that the message belongs to
id
string | undefined
The message ID of the message that was sent
readBy
string[]
Contains an Array of User.id's that have read the message
senderId
string
Contains the user ID for the person that sent the message
text
string
optional
type
"UserMessage" | "SystemMessage"
Identifies the message as either a User message or System message
override
({ text, custom }: { text?: string; custom?: CustomData; }) => void
This function allows you to modify the contents of the message or its metadata before the message is sent

SentMessage

A message that was sent to TalkJS

Properties

conversationId
string
The ID of the conversation that the message belongs to
id
string | undefined
The message ID of the message that was sent
readBy
string[]
Contains an Array of User.id's that have read the message
senderId
string
Contains the user ID for the person that sent the message
text
string
optional
type
"UserMessage" | "SystemMessage"
Identifies the message as either a User message or System message

ThirdPartyOptions

Used to configure supported third-party integrations with TalkJS. See third party integrations

Properties

fullstory
FullStoryOptions
optional

FullStoryOptions

host
string
optional
Fullstory hostname
org
string
Fullstory organization ID

UnreadConversation

Used as part of Unreads.on.

Properties

lastMessage
Message
Contains the last Message for an unread conversation.

Message

body
string
Contains the message's content
conversation
ConversationData
Contains the ConversationData that the message belongs to.
custom
CustomData
optional
isByMe
boolean
'true' if the message was sent by the current user.
origin
string
read
boolean
'true' if the message has been read, 'false' has not been seen yet
sender
User | null
The User that sent the message
senderId
string | null
The senderID (userID) for the person that sent the message
timestamp
number
The timestamp for the when the message was sent
type
"media" | "text" | "location"
Specifies if if the message is media (file), text or a shared location