/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Overview

Copy link

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 and JavaScript.


Message types

Copy link

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

Copy link

Characteristics and supported features of each message type are shown below.

TextFileAdmin

Class

UserMessage

FileMessage,
MultipleFilesMessage

AdminMessage

Content

Text only

File only

Text only

Send by user

Required

Required

Not required

Join group channel

Required

Required

Not required

Delivery receipts

Supported

Supported

N/A

Message search

Supported

Supported

N/A

Message threading

Supported

Supported

N/A

Polls

Supported

* Except scheduled message

N/A

N/A

Reactions

Supported

Supported

Supported

Read receipts

Supported

Supported

N/A

Translations

Supported

N/A

N/A


Functionalities by topic

Copy link

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

Copy link
FunctionalityDescriptionOpen channelGroup channel

Send a message

Sends a text or file message to a channel.

Send a critical alert message to iOS services

Sends a critical alert notification to iOS devices even when Mute or Do Not Disturb feature is on.

Send an admin message

Sends a message from an admin to a channel on the Sendbird Dashboard or using the Chat Platform API.

Cancel an in-progress file upload

Cancels a file upload that hasn't been completed yet.

Share an encrypted file

Encrypts files and thumbnail images for secure access to users in a channel.

Spam flood protection

Customizes the number of messages a user can send to a channel per second.

Smart throttling

Customizes the number of messages displayed in a channel per second.

Receiving messages through event handler

Copy link
FunctionalityDescriptionOpen channelGroup channel

Receive messages in a channel

Receives messages sent by other users in a channel through the channel event handler.

Using message threading

Copy link
FunctionalityDescriptionOpen channelGroup channel

Create a message thread

Sends a reply to a specific message in a channel. This can create a message thread.

List replies in a message thread

Retrieves replies to a parent message.

Retrieving messages

Copy link
FunctionalityDescriptionOpen channelGroup channel

Retrieve a message

Retrieves a specific message in a channel.

Retrieve a list of messages

Retrieves messages in a channel. You can load a set number of previous messages or messages based on its timestamp or message ID.

Retrieve the last message of a channel

Retrieves the last message in a channel.

Searching messages

Copy link
FunctionalityDescriptionOpen channelGroup channel

Search messages by a keyword

Retrieves a list of messages that contain a search query or a specified keyword.

Managing a message

Copy link
FunctionalityDescriptionOpen channelGroup channel

Copy a message

Copies a message in a channel and sends it to the same channel or another channel.

Update a message

Updates a text or file message in a channel. Users can only update their own messages. Operators can update any messages in the channel.

Delete a message

Deletes a text or file message in a channel. Users can only delete their own messages. Operators can delete any messages in the channel.

React to a message in a channel

Adds an emoji to a message.

Clear the chat history in a channel

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.

Send typing indicators to other users

Indicates to other users in the channel that a user is typing up a message to the channel.

Display Open Graph tags in a message

Displays a URL link preview when a message contains a web page URL.

Generate thumbnails of a file message

Creates a thumbnail of an image file.

Listing changelogs

Copy link
FunctionalityDescriptionOpen channelGroup channel

List changelogs of messages

Retrieves message changelogs by timestamp or token.

Marking messages as read

Copy link
FunctionalityDescriptionOpen channelGroup channel

Mark messages as read

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

Copy link
FunctionalityDescriptionOpen channelGroup channel

Mark messages as delivered

Marks messages as delivered when a user who is online receives messages from the Sendbird server.

Mentioning other users in a message

Copy link
FunctionalityDescriptionOpen channelGroup channel

Mention other users in a message

Includes other users in the channel in a message.

Managing polls

Copy link
FunctionalityDescriptionOpen channelGroup channel

Create a poll

Creates a poll with at least one poll option and sends as a user message.

Retrieve a poll

Retrieves a specific poll in a channel.

Update a poll

Updates a poll in a channel.

Delete a poll

Deletes a poll in a channel.

Close a poll

Closes a poll in a channel.

Add a poll option

Adds a voting option for a poll in a channel.

Retrieve a poll option

Retrieves a specific poll option in a channel.

Update a poll option

Updates a poll option in a channel.

Delete a poll option

Deletes a poll option in a channel.

Cast or cancel a vote

Adds or removes a vote from a poll option.

Retrieve a list of polls

Retrieves a list of polls in a channel.

Retrieve a list of voters

Retrieves a list of voters of a poll in a channel.

List changelogs of polls

List changelogs of polls by specifying a timestamp or a token.

Retrieving unread count

Copy link
FunctionalityDescriptionOpen channelGroup channel

Retrieve number of unread messages in a channel

Retrieves the number of messages in a channel a user hasn't read.

Retrieve number of unread messages in all channels

Retrieves the number of messages a user hasn't read in all channels they are in.

Retrieve number of channels with unread messages

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.

Retrieve number of unread items

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

Copy link
FunctionalityDescriptionOpen channelGroup channel

Categorize messages by custom type

Specifies a custom message type to search or filter messages by.

Adding extra data to a message

Copy link
FunctionalityDescriptionOpen channelGroup channel

Add extra data to a message

Adds one or more key-value items to a message to add extra information.

Translating messages

Copy link
FunctionalityDescriptionOpen channelGroup channel

Auto-translate messages

Translates messages into specified languages and sends to channel.

Translate messages on-demand

Translates messages according to user needs.

Translation engine

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.