Overview
Sendbird Chat SDK for JavaScript provides expansive messaging features to enhance users' chat experience. Basic and foundational messaging features such as sending, copying, updating, and deleting a message make up the essential chat experience. You can also load as well as receive messages through channel event handlers. Features related to marking messages as read, counting the number of unread messages, adding extra data to a message, reporting a message, and local caching are available to support a wide range of user needs.
Note: Sendbird Chat SDK v4 supports both
TypeScript
andJavaScript
.
Message types
There are three types of messages in Sendbird Chat.
-
Text: A message containing a string of text. The message must be sent by a user and, in the case of group channels, the user must be a member of the channel to be able to send the message.
-
File: A message containing a file, which can be directly uploaded to the Sendbird server or specified by its URL. The message must be sent by a user and, in the case of group channels, the user must be a member of the channel to be able to send the message.
-
Multiple files: A message containing more than two files, which can be directly uploaded to the Sendbird server or specified by their URL. These messages are supported only in group channels and, just like a regular file message, the sender must be a member of the channels. The maximum number of file attachments is 30 and the maximum size per file is set to 25MB as a default. To adjust the numbers, contact our Sales team.
-
Admin: A system message sent without a sender and, in the case of group channels, without the sender needing to be a member of the channel. Admin message can be sent using the Chat API or Sendbird Dashboard. Common use cases include general notices to a channel like "Livestream will begin in 1 minute! Your messages may be monitored to ensure a safe, welcoming environment." and auto event messages like "User 1 joined the channel."
Comparing message types
Characteristics and supported features of each message type are shown below.
Text | File | Admin | |
---|---|---|---|
Class |
|
|
|
Content | Text only | File only | Text only |
Send by user | Required | Required | Not required |
Required | Required | Not required | |
Supported | Supported | N/A | |
Supported | Supported | N/A | |
Supported | Supported | N/A | |
Supported | N/A | N/A | |
Supported | Supported | Supported | |
Supported | Supported | N/A | |
Supported | N/A | N/A |
Functionalities by topic
Users can interact with other users in a channel by sending, receiving, replying to messages, and more. The following is a list of functionalities that our Chat SDK provides.
Sending a message
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Sends a text or file message to a channel. | |||
Sends a critical alert notification to iOS devices even when Mute or Do Not Disturb feature is on. | |||
Sends a message from an admin to a channel on the Sendbird Dashboard or using the Chat Platform API. | |||
Cancels a file upload that hasn't been completed yet. | |||
Encrypts files and thumbnail images for secure access to users in a channel. | |||
Customizes the number of messages a user can send to a channel per second. | |||
Customizes the number of messages displayed in a channel per second. |
Receiving messages through event handler
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Receives messages sent by other users in a channel through the channel event handler. |
Using message threading
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Sends a reply to a specific message in a channel. This can create a message thread. | |||
Retrieves replies to a parent message. |
Retrieving messages
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Retrieves a specific message in a channel. | |||
Retrieves messages in a channel. You can load a set number of previous messages or messages based on its timestamp or message ID. | |||
Retrieves the last message in a channel. |
Searching messages
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Retrieves a list of messages that contain a search query or a specified keyword. |
Managing a message
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Copies a message in a channel and sends it to the same channel or another channel. | |||
Updates a text or file message in a channel. Users can only update their own messages. Operators can update any messages in the channel. | |||
Deletes a text or file message in a channel. Users can only delete their own messages. Operators can delete any messages in the channel. | |||
Adds an emoji to a message. | |||
Clears the chat history from the channel view of the current user. Messages aren't deleted from the Sendbird system's database and other users in the channel can still view all the messages in their own channel view. | |||
Indicates to other users in the channel that a user is typing up a message to the channel. | |||
Displays a URL link preview when a message contains a web page URL. | |||
Creates a thumbnail of an image file. |
Listing changelogs
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Retrieves message changelogs by timestamp or token. |
Marking messages as read
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Marks messages in a channel as read when a user enters the channel or brings the opened channel view to the foreground. |
Marking messages as delivered
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Marks messages as delivered when a user who is online receives messages from the Sendbird server. |
Mentioning other users in a message
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Includes other users in the channel in a message. |
Managing polls
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Creates a poll with at least one poll option and sends as a user message. | |||
Retrieves a specific poll in a channel. | |||
Updates a poll in a channel. | |||
Deletes a poll in a channel. | |||
Closes a poll in a channel. | |||
Adds a voting option for a poll in a channel. | |||
Retrieves a specific poll option in a channel. | |||
Updates a poll option in a channel. | |||
Deletes a poll option in a channel. | |||
Adds or removes a vote from a poll option. | |||
Retrieves a list of polls in a channel. | |||
Retrieves a list of voters of a poll in a channel. | |||
List changelogs of polls by specifying a timestamp or a token. |
Retrieving unread count
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Retrieves the number of messages in a channel a user hasn't read. | |||
Retrieves the number of messages a user hasn't read in all channels they are in. | |||
Retrieves the number of channels where a user hasn't read one or more messages. | |||
Retrieve number of members who haven’t received a message in a channel | Retrieves the number of users in a channel who have yet to receive a specific message. | ||
Retrieve number of members who haven’t read a message in a channel | Retrieves the number of users in a channel who haven't read a specific message. | ||
Retrieves the number of messages a user hasn't read, unread messages a user is mentioned in, and invitations to group and Supergroup channels a user has received. |
Categorizing messages
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Specifies a custom message type to search or filter messages by. |
Adding extra data to a message
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Adds one or more key-value items to a message to add extra information. |
Translating messages
Functionality | Description | Open channel | Group channel |
---|---|---|---|
Translates messages into specified languages and sends to channel. | |||
Translates messages according to user needs. | |||
Sendbird’s message auto-translation and on-demand features are powered by Google Cloud Translation API's recognition engine. The recognition engine supports a wide variety of languages for the Neural Machine Translation (NMT) model. |