/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Update metadata

    Copy link

    Updates values of specific items by their keys.


    HTTP request

    Copy link
    PUT https://api-{application_id}.sendbird.com/v3/{channel_type}/{channel_url}/messages/{message_id}/sorted_metaarray
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    channel_type

    string

    Specifies the type of the channel. Acceptable values are open_channels and group_channels.

    channel_url

    string

    Specifies the URL of the target channel.

    message_id

    long

    Specifies the unique ID of the message to update key-values items.


    Request body

    Copy link

    The following table lists the properties of an HTTP request that this action supports.

    Properties
    RequiredTypeDescription

    sorted_metaarray

    array of objects

    Specifies an array of one or more JSON objects consisting of key-values items which store additional message information. Items are saved and returned in the exact order they've been specified.

    mode

    string

    Determines whether to add the specified values in the items or remove the specified values from the existing items. Acceptable values are add and remove. If set to add, the specified values are added only when they are different from the existing values. If set to remove, the specified values are removed only when they have the corresponding ones in the existing values.

    upsert

    boolean

    Determines whether to add new items in addition to updating existing items. If true, new key-values items are added when there are no items with the keys. The existing items are updated with new values when there are already items with the keys. If false, only the items of the keys that match the ones you specify are updated with new values. (Default: false)

    metaarray

    array of objects

    (Deprecated) Specifies an array of one or more JSON objects consisting of key-value pair items which store additional message information.

    add-moderemove-modeupsert
    # Request body example
    {
        "sorted_metaarray": [
            {
                "key": "places",
                "value": ["department store"]   // A new value
            },
            {
                "key": "beverages",
                "value": ["tea"]        // A new value
            }
        ],
        "mode": "add"
    }
    

    Response

    Copy link

    If successful, this action returns all registered items including the key and values of updated items in the response body.

    add-moderemove-modeupsert
    # Status: 200 OK
    {
        "sorted_metaarray": [
            {
                "key": "places",
                "value": ["office", "cafe", "restaurant", "department store"]   // "department store" is added.
            },
            {
                "key": "beverages",
                "value": ["water", "milk", "coffee", "tea"] // "tea" is added.
            }
        ]
    }
    

    In the case of an error, an error object is returned. A detailed list of error codes is available here.