Overview
With Sendbird's Chat Platform API, you can build messaging functionalities ranging from the essential to the advanced, including features such as message threading, delivery receipts, and emoji reactions.
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.
-
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. 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 | |
---|---|---|---|
Representative value |
|
|
|
Content | Text only | File only | Text only |
Send by user | Required | Required | Not required |
Required | Required | Not required | |
Supported | N/A | Supported | |
Supported | Supported | N/A | |
Supported | Supported | N/A | |
Supported | Supported | N/A | |
Supported | Supported | Supported | |
Supported | N/A | N/A | |
Supported | Supported | N/A | |
Supported | Supported | Supported | |
Supported | N/A | N/A |
Resource representation
The following tables show the lists of properties in a message resource for a text message, file message, and admin message.
List of properties for a text message
Property name | Type | Description |
---|---|---|
message_id | long | The unique ID of the message. |
type | string | The type of the message. The value is |
custom_type | string | The custom message type used for message grouping. The length is limited to 128 characters. |
channel_url | string | The unique URL of the channel where the message is sent to. |
user | nested object | The user who sent the message. |
mention_type | string | The mention type that indicates whether to call the attention of specific users or all users in the channel. The value of |
mentioned_users[] | array of objects | An array of users mentioned in the message. |
is_removed | boolean | Indicates whether the message is removed from the channel. |
message | string | The content of the message. |
translations | object | The messages translated from the original language into one or more specified languages. |
data | string | Additional message information such as custom font size or font type in JSON or other formats. More details on what can be stored in this field are available here. |
sorted_metaarray | array of objects | An array of JSON objects consisting of key-values items to store additional message information which can be used for classification and filtering. When retrieving, items are returned in the order they were added. More details on what can be stored in this field are available here. |
message_events | nested object | A set of events configured for each instance a message is sent or updated. |
message_events.send_push_notification | string | Indicates which group of users to send push notifications to. Acceptable values are the following. |
message_events.update_unread_count | boolean | Indicates whether to update |
message_events.update_last_message | boolean | Indicates whether to update the |
og_tag | nested object | The Open Graph |
created_at | long | The time when the message was sent in Unix milliseconds |
updated_at | long | The time when the message was updated in Unix milliseconds |
file | nested object | The file contained in the message. This property is empty for any text messages. |
is_apple_critical_alert | boolean | Indicates whether the message is a critical alert. |
thread_info | nested object | The thread information consisting of the |
thread_info.reply_count | long | The total number of replies in the thread. The value of |
thread_info.most_replies | array of objects | An array of one or more |
thread_info.last_replied_at | long | The time when the last reply was added in Unix milliseconds |
thread_info.updated_at | long | The time when the thread information was updated due to a deleted or newly added reply in the thread, in Unix milliseconds |
parent_message_id | long | The unique ID of a thread's parent message. This property is only retrieved if the message is a reply. |
parent_message_info | nested object | The information of the thread's parent message including the text, user information, and message type. This property is only retrieved if the message is a reply. |
is_reply_to_channel | boolean | Indicates whether the message was sent as a reply to the channel. |
| long | (Deprecated) Reserved value. This must be the same as |
| string | (Deprecated) The text of a thread's parent message. If the |
List of properties for a file message
Property name | Type | Description |
---|---|---|
message_id | long | The unique ID of the message. |
type | string | The type of the message. The value is |
custom_type | string | The custom message type used for message grouping. The length is limited to 128 characters. |
channel_url | string | The unique URL of the channel where the message is sent to. |
user | nested object | The user who sent the message. |
mention_type | string | The mention type that indicates whether to call the attention of specific users or all users in the channel. The value of |
mentioned_users[] | array of objects | An array of users mentioned in the message. |
is_removed | boolean | Indicates whether the message is removed from the channel. |
file | nested object | The information on the file in the message, which was either directly updated to Sendbird server or specified by an externally hosted URL. |
file.url | string | The URL of the file where it is hosted. |
file.name | string | The name of the file that you can specify. |
file.type | string | The MIME |
file.size | int | The size of the file that you can specify. |
file.data | string | The string data which can contain additional message information such as custom font size, font type, or a JSON-formatted string. |
sorted_metaarray | array of objects | An array of one or more JSON objects consisting of key-value items to store additional message information. When retrieving, items are returned in the order they were added. |
thumbnails[] | array of objects | An array of thumbnail images that were either automatically generated by Sendbird server from the uploaded image or video file in the message or specified by externally hosted URLs. |
require_auth | boolean | Indicates whether to require an authentication key to verify if the file is being properly accessed. Only the user who uploaded the file or users who are in the channel where the file was uploaded should have access. The authentication key managed internally by the Sendbird system is generated every time a user logs in to the Sendbird server and is valid for three days starting from the last login. If set to |
message_events | nested object | A set of events configured for each instance a message is sent or updated. |
message_events.send_push_notification | string | Indicates which group of users to send push notifications to. Acceptable values are the following. |
message_events.update_unread_count | boolean | Indicates whether to update |
message_events.update_last_message | boolean | Indicates whether to update the |
created_at | long | The time when the message was sent in Unix milliseconds |
updated_at | long | The time when the message was updated in Unix milliseconds |
thread_info | nested object | The thread information consisting of the |
thread_info.reply_count | long | The total number of replies in the thread. The value of |
thread_info.most_replies | array of objects | An array of one or more JSON objects containing the information of one or more users who replied the most. Up to five objects can be returned. |
thread_info.last_replied_at | long | The time when the last reply was added in Unix milliseconds |
thread_info.updated_at | long | The time when the thread information was updated due to a deleted or newly added reply in the thread, in Unix milliseconds |
parent_message_id | long | The unique ID of a thread's parent message. This property is only retrieved if the message is a reply. |
parent_message_info | nested object | The information of the thread's parent message including the text, user information, and message type. This property is only retrieved if the message is a reply. |
is_reply_to_channel | boolean | Indicates whether the message was sent as a reply to the channel. |
| string | (Deprecated) The text of a thread's parent message. If the |
List of properties for an admin message
Property name | Type | Description |
---|---|---|
message_id | long | The unique ID of the message. |
type | string | The type of the message. The value is |
custom_type | string | The custom message type used for message grouping. The length is limited to 128 characters. |
channel_url | string | The unique URL of the channel where the message is sent to. |
mention_type | string | The mention type that indicates whether to call the attention of specific users or all users in the channel. The value of |
mentioned_users[] | array of objects | An array of users mentioned in the message. |
is_removed | boolean | Indicates whether the message is removed from the channel. |
message | string | The content of the message. |
data | string | A string data which can contain additional message information such as custom font size, font type, or a JSON-formatted string. |
sorted_metaarray | array of objects | An array of one or more JSON objects consisting of key-value items to store additional message information. When retrieving, items are returned in the order they were added. |
message_events | nested object | A set of events configured for each instance a message is sent or updated. |
message_events.send_push_notification | string | Indicates which group of users to send push notifications to. Acceptable values are the following. |
message_events.update_unread_count | boolean | Indicates whether to update |
message_events.update_last_message | boolean | Indicates whether to update the |
og_tag | nested object | The Open Graph |
created_at | long | The time when the message was sent in Unix milliseconds |
updated_at | long | The time when the message was updated in Unix milliseconds |