Other interfaces
Thursday, January 28, 2021 1:51 AMinterface 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 SelectConversationEvent | Event data triggered from Inbox.on("selectConversation"). |
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 |
interface SentMessage | A message that was sent to TalkJS |
class TalkError | TalkJS Error class, inherits from the global Error class. |
interface ThirdPartyOptions | Used to configure supported third-party integrations with TalkJS. See third party integrations |
interface TranslationToggledEvent | This event is triggered when the user toggles real-time message translation using the built-in toggle. |
interface UserData |
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 |
idstring | The ID of the conversation |
photoUrlstring | null optional | An optional URL to a photo which will be shown as the photo for the conversation. |
subjectstring | null optional | An optional conversation subject which is displayed in the chat header |
topicIdstring | Legacy - please use subject instead. |
welcomeMessagesArray<string> | null optional |
interface ConversationSelectedEvent
This represents the interface of the event triggered from Inbox.on("conversationSelected").Properties
conversationConversationData | null | The current conversation object | ||||||||||||||||||
me | The current TalkJS User | ||||||||||||||||||
interface UserData
| |||||||||||||||||||
othersArray<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 |
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
Returns
voidsetText
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, call this method before calling Inbox.mount Parameters
textstring | The text to be displayed in the message entry field |
Returns
voidsetVisible
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
visibleboolean | ConversationPredicate | boolean or a more advanced predicate. |
Returns
voidinterface MessageFieldOptions
Properties
enterSendsMessageboolean 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 . |
placeholderstring 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). |
spellcheckboolean 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 . |
visibleboolean | ConversationPredicate 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: Defaults to true . |
interface SelectConversationEvent
Event data triggered from Inbox.on("selectConversation").Methods
preventDefault | Prevents the clicked conversation from being selected. |
Properties
conversation | The current conversation object | ||||||||||||||||||
interface ConversationData
| |||||||||||||||||||
me | The current TalkJS User | ||||||||||||||||||
interface UserData
| |||||||||||||||||||
othersArray<UserData> | The other participants in the conversation that are not the current user |
Method Details
preventDefault
selectconversationevent.preventDefault()
Prevents the clicked conversation from being selected.
Parameters
Returns
voidinterface 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 usingoverride()
. Properties
conversation | The current conversation object | ||||||||||||||||||
interface ConversationData
| |||||||||||||||||||
me | The current TalkJS user | ||||||||||||||||||
interface UserData
| |||||||||||||||||||
message | The message that was sent | ||||||||||||||||||
interface SentMessage
| |||||||||||||||||||
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 TalkJSProperties
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. |
conversationIdstring | The ID of the conversation that the message belongs to |
idstring | 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: |
readBystring[] | Contains an Array of User.id's that have read the message |
senderIdstring | Contains the user ID for the person that sent the message |
textstring optional | Contains the message's text |
type"UserMessage" | "SystemMessage" | Identifies the message as either a User message or System message |
class TalkError
TalkJS Error class, inherits from the global Error class. TalkJS methods may throw (or reject promises with) instances of this class if specific catchable information can be provided through the code
property.
Properties
codeErrorCode | Machine-readable error code |
messagestring | Human-readable error message |
interface ThirdPartyOptions
Used to configure supported third-party integrations with TalkJS. See third party integrationsProperties
fullstoryFullStoryOptions optional | |||||
interface FullStoryOptions
|
interface TranslationToggledEvent
This event is triggered when the user toggles real-time message translation using the built-in toggle.Properties
conversation | Conversation for which translation has been toggled | ||||||||||||
interface ConversationData
| |||||||||||||
isEnabledboolean | Boolean indicating if translation is enabled or not |
interface UserData
Properties
availabilityTextstring | null | Availability acts similarly to User.welcomeMessage but appears as a system message. | ||
custom | Allows you to set custom metadata for the User | ||
interface CustomData
| |||
idstring | number | The unqiue ID which is used to identify the user in TalkJS | ||
localestring | null | The locale field expects an IETF language tag. See the localization documentation. | ||
namestring | The User's name which will be displayed on the TalkJS UI | ||
photoUrlstring | null | An optional URL to a photo which will be displayed as the user's avatar | ||
rolestring | null | TalkJS supports multiple sets of settings, called "roles". These allow you to change the behavior of TalkJS for different users. You have full control over which user gets which configuration. | ||
welcomeMessagestring | null | The default message a user sees when starting a chat with that person | ||
configurationstring | null | Deprecated. Please use role instead. |