Chat / Platform API
Current version: v3
    Chat Platform API v3
    Chat Platform API
    Chat
    Platform API
    Home
    /
    Chat
    /
    Platform API

    Overview

    With the Message 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 message: A text message sent by a user in a channel.
    • File message: A file message sent by a user in a channel.
    • Admin message: A message sent only by an admin through the Chat API or the Sendbird Dashboard.

    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 nameTypeDescription

    message_id

    long

    The unique ID of the message.

    type

    string

    The type of the message. The value is MESG for a text message.

    custom_type

    string

    The custom message type used for message grouping. The length is limited to 128 characters.

    * Custom types are also used to segment metrics within Sendbird's Advanced analytics, which enables the sub-classification of data views.

    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 users indicates that up to ten users in mentioned_user_ids are notified of the mention, while the value of channel indicates that up to ten users in the channel are notified of the mention.

    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.

    og_tag

    nested object

    The Open Graph (OG) metadata contained in the given URL when a text message or an admin message includes the URL of a web page. This consists of properties such as og:url, og:title, og:description, and og:image.

    created_at

    long

    The time when the message was sent in Unix milliseconds format.

    updated_at

    long

    The time when the message was updated in Unix milliseconds format.

    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 reply count, most_replies, last_replied_at, and updated_at properties. The thread_info property is only retrieved if the message is a parent message.

    thread_info.reply_count

    long

    The total number of replies in the thread. The value of 0 indicates that there is no reply.

    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 format. The value of 0 indicates that there is no reply.

    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 format.

    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.

    root_message_id

    long

    (Deprecated) Reserved value. This must be the same as parent_message_id.

    parent_message_text

    string

    (Deprecated) The text of a thread's parent message. If the include_parent_message_text parameter is set to true, the value of this property is retrieved in the response.

    List of properties for a file message

    Property nameTypeDescription

    message_id

    long

    The unique ID of the message.

    type

    string

    The type of the message. The value is FILE for a file message.

    custom_type

    string

    The custom message type used for message grouping. The length is limited to 128 characters.

    * Custom types are also used to segment metrics within Sendbird's Advanced analytics, which enables the sub-classification of data views.

    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 users indicates that up to ten users in mentioned_user_ids are notified of the mention, while the value of channel indicates that up to ten users in the channel are notified of the mention.

    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 type of the file that you can specify.

    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 JSON formatted string.

    sorted_metaarray

    array of objects

    An array of one or more JSON objects consisting of key-values 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 the files and thumbnail images in a message are only accessible by users who are in the same channel. This property is only effective when using the share encrypted files feature. This feature encrypts any type of uploaded files and the automatically-generated thumbnail images with AES256, stores them securely in the Sendbird server, and only allows the users with access to share the files. You can use this property to restrict access to the files.

    If set to true, the files are uploaded first, then encrypted, and finally stored along with the thumbnail images which are encrypted as well. When accessing them, the parameter auth, which is specified with an encryption key of the user such as ?auth=RW5b2RIHaMdGV4eA==, should be added to the end of the file URLs. An encryption 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. The system mainly uses the key to check if a user is properly accessing the data of the application. (Default: false)

    created_at

    long

    The time when the message was sent in Unix milliseconds format.

    updated_at

    long

    The time when the message was updated in Unix milliseconds format.

    thread_info

    nested object

    The thread information consisting of the reply count, most_replies, last_replied_at, and updated_at properties. The thread_info property is only retrieved if the message is a parent message.

    thread_info.reply_count

    long

    The total number of replies in the thread. The value of 0 indicates that there is no reply.

    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 format. The value of 0 indicates that there is no reply.

    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 format.

    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.

    parent_message_text

    string

    (Deprecated) The text of a thread's parent message. If the include_parent_message_text parameter is set to true, the value of this property is retrieved in the response.

    List of properties for an admin message

    Property nameTypeDescription

    message_id

    long

    The unique ID of the message.

    type

    string

    The type of the message. The value is ADMM for an admin message.

    custom_type

    string

    The custom message type used for message grouping. The length is limited to 128 characters.

    * Custom types are also used to segment metrics within Sendbird's Advanced analytics, which enables the sub-classification of data views.

    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 users indicates that up to ten users in mentioned_user_ids are notified of the mention, while the value of channel indicates that up to ten users in the channel are notified of the mention.

    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 JSON formatted string.

    sorted_metaarray

    array of objects

    An array of one or more JSON objects consisting of key-values items to store additional message information. When retrieving, items are returned in the order they were added.

    og_tag

    nested object

    The Open Graph (OG) metadata contained in the given URL when a text message or an admin message includes the URL of a web page. This consists of properties such as og:url, og:title, og:description, and og:image.

    created_at

    long

    The time when the message was sent in Unix milliseconds format.

    updated_at

    long

    The time when the message was updated in Unix milliseconds format.