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

    Register and schedule a data export

    Copy link

    Registers and schedules a message, channel, or user data export.


    HTTP request

    Copy link
    POST https://api-{application_id}.sendbird.com/v3/export/{data_type}
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    data_type

    string

    Specifies the type of data to export. Acceptable values are messages, channels, users, and failed_webhooks.


    Request body

    Copy link

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

    Properties
    RequiredTypeDescription

    start_ts

    long

    The start time of a period for the target data's creation date in Unix milliseconds format. The creation time of the target data type is in between the time period set by the start_ts and end_ts properties.

    end_ts

    long

    The end time of a period for the target data's creation date in Unix milliseconds format. The creation time of the target data type is in between the time period set by the start_ts and end_ts properties.

    OptionalTypeDescription

    format

    string

    Specifies the format of the file to export messages in. Acceptable values are json and csv. (Default: json)

    csv_delimiter

    string

    Sets a single character delimiter to separate the values in each row of the csv file which stores two-dimensional arrays of the exported message data. Either English alphabets or special characters can be used as a delimiter, including a horizontal tab (\t), a line feed (\n), a vertical bar (|), and a space (" "). This property is only effective when a value of the format property is csv. (Default: ,)

    timezone

    string

    Specifies the timezone to be applied to the timestamp of the exported messages. For example, US/Pacific, Asia/Seoul, Europe/London, etc. (Default: UTC)

    sender_ids[]

    array of strings

    Specifies an array of user IDs that are used to filter messages by sender for data export. Up to 10 user IDs can be specified in the request. This property is effective only when a value of the data_type parameter is set to messages.

    exclude_sender_ids[]

    array of strings

    Specifies an array of user IDs that are used to exclude messages sent by the specified users from data export. Up to 10 user IDs can be specified in the request. This property is effective only when a value of the data_type parameter is set to messages.

    channel_urls[]

    array of strings

    Specifies an array of one or more URLs of channels to extract messages to be included in the data export. This property is effective only when a value of the data_type parameter is set to messages or channels.

    exclude_channel_urls[]

    array of strings

    Specifies an array of one or more URLs of channels to exclude when exporting messages. This property is effective only when a value of the data_type parameter is set to messages or channels.

    user_ids[]

    array of strings

    Specifies an array of user IDs to include their information in the data export. This property is effective only when a value of the data_type parameter is set to users.

    show_read_receipt

    boolean

    Determines whether to include information about the read receipts of each channel in the data to be exported. A read receipt indicates the timestamp of when a user has last read the messages in the channel in Unix milliseconds format. (Default: true)

    show_channel_metadata

    boolean

    Determines whether to include channel metadata in the result files. (Default: false)

    neighboring_message_limit

    int

    Specifies the number of immediately preceding and succeeding messages sent by user IDs that aren't specified in sender_ids to include in the data to be exported when messages in a channel are filtered by a value of the sender_ids property. A message sent by a user ID not specified in sender_ids is only included in the data to be exported when the message is included in the count of immediately preceding and succeeding messages. This can be used to better analyze the context of messages in a channel. Acceptable values are 1 to 10, inclusive. (Default: 0)

    messageschannelsusersfailed_webhooks
    # Request body example
    {
        "start_ts": 1544367600000,
        "end_ts": 1544453999000,
        "format": "csv",
        "csv_delimiter": "|",
        "timezone": "US/Pacific",
        "channel_urls": ["public_chat_room_031", "public_chat_room_032"],
        "sender_ids": ["Tom", "Jeff", "Rommel"]
    }
    

    Response

    Copy link

    If successful, this action returns a data export resource in the response body.

    messageschannelsusersfailed_webhooks
    # Status: 200 OK
    {
        "request_id": "1ed107739a77414",
        "data_type": "messages",
        "status": "scheduled",
        "format": "csv",
        "csv_delimiter": "|",
        "timezone": "US/Pacific",
        "created_at": 1503112356286,
        "start_ts": 1544367600000,
        "end_ts": 1544453999000,
        "channel_urls": [
            "public_chat_room_031", "public_chat_room_032"
        ],
        "sender_ids": [
            "Tom", "Jeff", "Alek"
        ]
    }
    

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