interface Conversation

Deprecated. Encapsulates an active conversation between two parties.

interface ConversationSelectedEvent

This represents the interface of the event triggered from Inbox.on("conversationSelected").

interface MessageField

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

interface MessageFieldOptions

interface 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().

interface SentMessage

A message that was sent to TalkJS

interface ThirdPartyOptions

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

interface 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
{     [name: string]: string | null } | null

optional
Optional custom conversation meta data
id
string
The ID of the conversation
photoUrl
string | null

optional
An optional URL to a photo which will be shown as the photo for the conversation.
subject
string | null

optional
An optional conversation subject which is displayed in the chat header
topicId
string
Legacy - please use subject instead.
welcomeMessages
Array<string> | null

optional

interface ConversationSelectedEvent

This represents the interface of the event triggered from Inbox.on("conversationSelected").

Properties

conversation
The current conversation object
me
UserData
The current TalkJS User
others
Array<UserData>

optional
The other participants in the conversation that are not the current user

interface 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).

setVisible

Sets the visibility of the Message Field to a given value or to a certain predicate. See MessageFieldOptions.visible for examples.

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

The text to be displayed in the message entry field

Returns

void

setVisible

messagefield.setVisible(visible)

Sets the visibility of the Message Field to a given value or to a certain predicate. See MessageFieldOptions.visible for examples.

Parameters

visible

boolean or a more advanced predicate.

Returns

void

interface MessageFieldOptions

Properties

enterSendsMessage
boolean

optional
If set to true, pressing the enter key sends the message (if there is text in the message field). When set to false, the only way to send a message is by clicking or touching the "Send" button. Defaults to true.
placeholder
string

optional
Overrides the "placeholder" in the message field, which displays a dimmed text when no text has yet been entered. Defaults to "Say something..." (or a translation thereof).
spellcheck
boolean

optional
Specifies whether the spellcheck attribute is set on the message field. Note that setting this to true may also enable autocorrect on some mobile devices. Defaults to false.
visible

optional
Determines whether the message field is visible. Pass either a boolean (false to hide it), or a ConversationPredicate. The latter approach lets you show/hide the message field based on properties of the current conversation. For example, to hide the message field when the current user has no write access to the current conversation, do the following:
// this predicate holds iff the current user's `access` to the current conversation is
// set to "ReadWrite"`:
const showMessageField = { access: ["==", "ReadWrite"] };
session.createInbox(conversation, { messageField: { visible: showMessageField } });
Defaults to true.

interface 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
The current conversation object

interface ConversationData

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

Deprecated. Please use ConversationBuilder.subject instead.

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

interface SentMessage

attachment
{     url: string     size: number }

optional
Only given if the message contains a file. An object with the URL and filesize (in bytes) of the given file.
conversationId
string
The ID of the conversation that the message belongs to
id
string | undefined
The message ID of the message that was sent
location
[number, number]

optional
Only given if the message contains a location. An array of two numbers which represent the longitude and latitude of this location, respectively. Only given if this message is a shared location. Example:
[51.481083, -3.178306]
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
Contains the message's text
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

interface SentMessage

A message that was sent to TalkJS

Properties

attachment
{     url: string     size: number }

optional
Only given if the message contains a file. An object with the URL and filesize (in bytes) of the given file.
conversationId
string
The ID of the conversation that the message belongs to
id
string | undefined
The message ID of the message that was sent
location
[number, number]

optional
Only given if the message contains a location. An array of two numbers which represent the longitude and latitude of this location, respectively. Only given if this message is a shared location. Example:
[51.481083, -3.178306]
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
Contains the message's text
type
"UserMessage" | "SystemMessage"
Identifies the message as either a User message or System message

interface ThirdPartyOptions

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

Properties

fullstory
FullStoryOptions

optional

interface FullStoryOptions

host
string

optional
Fullstory hostname
org
string
Fullstory organization ID