Platform API
Migration

Migration

Using our migration API, you can migrate the messages of your current chat solution to the SendBird system.

Note: If you are looking for a way to migrate your Layer chat data to SendBird, see our blog's Migrating chat made easy with Sync Server. The SendBird SyncServer is a service that supports live migration of chat data from Layer to SendBird. It is fully managed so that you don't need to worry about hosting or monitoring server infrastructure.


Migrate messages

Using our migration API, you can migrate the messages from another system into a SendBird system's channel which consists of users, messages, and other chat-related data.

This is one of SendBird's premium features, contact our sales team for further assistance.

There are three things to do in advance before the migration. Follow the instructions below:

  1. Register the users of your current chat solution to your SendBird application. You can migrate the users into the SendBird system using the user creation API.
  2. Create either an open or a group channel to migrate the messages of your chat solution. The SendBird system doesn't create a channel for your migration automatically.
  3. The maximum number of migrated messages per call is 100. To avoid the failure during your migration, you must adjust the number of messages to process at once via the API.

HTTP request

Light Color Skin
Copy
POST https://api-{application_id}.sendbird.com/v3/migration/{target_channel_url}   

Note: If you want to know the ID and base URL of your application, sign in to your dashboard, select the application, open the Overview, and then check the App credentials > App ID, API request URL.

Parameters

The following table lists the parameters that this action supports.

Parameters
RequiredTypeDescription

target_channel_url

string

Specifies the URL of the channel to migrate the messages.

OptionalTypeDescription

update_read_ts

boolean

This parameter can only be used if the target channel for migration is a group channel. Determines whether to update the read receipt and unread message count of each member in the channel based on the sent time of the latest message in the migrated messages. (Default: false)

Request body

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

Text message
Properties
RequiredTypeDescription

message_type

string

Spcifies the type of the message as MESG. (Default: MESG)

messages[]

list

Specifies a list of text messages to migrate into the channel.

(message).user_id

string

Specifies the ID of the user who sent the message. Note that this user should be registered to your SendBird application in advance, or else an error is returned.

(message).message

string

Specifies the content of the message.

(message).timestamp

long

Specifies the time when the message was sent in Unix milliseconds format. You can sort the messages based on this timestamp.

OptionalTypeDescription

(message).custom_type

string

Specifies a custom message type which is used for message grouping. The length is limited to 128 bytes.

(message).mentioned_user_ids[]

array

Specifies an array of one or more IDs of the users who got a notification for the message.

(message).data

string

Specifies additional data that you stored for the message. This property can be the structured data such as a JSON object.

File message
Properties
RequiredTypeDescription

message_type

string

Specifies the type of the message as FILE.

messages[]

list

Specifies a list of file messages to migrate into the channel.

(message).user_id

string

Specifies the ID of the user who sent the message. Note that this user should be registered to your SendBird application in advance, or else an error is returned.

(message).timestamp

long

Specifies the time when the message was sent in Unix milliseconds format. You can sort the messages based on this timestamp.

(message).url

string

Specifies the URL of the file which is hosted on the server of your own or other external third party companies.

OptionalTypeDescription

(message).file_name

string

This property is not automatically generated, so you should specify the name of the file.

(message).file_size

string

This property is not automatically generated, so you should specify the size of the file.

(message).file_type

string

This property is not automatically generated, so you should specify the media type of the file.

(message).custom_type

string

Specifies a custom message type which is used for message grouping. The length is limited to 128 bytes.

(message).custom_field

string

Specifies additional data that you stored for the specified file in the message.

(message).mentioned_user_ids[]

array

Specifies an array of one or more IDs of the users who got a notification for the message.

Admin message
Properties
RequiredTypeDescription

message_type

string

Specifies the type of the message as ADMM.

messages[]

list

Specifies a list of admin messages to migrate into the channel.

(message).message

string

Specifies the content of the message.

(message).timestamp

long

Specifies the time when the message was sent in Unix milliseconds format. You can sort the messages based on this timestamp.

OptionalTypeDescription

(message).custom_type

string

Specifies a custom message type which is used for message grouping. The length is limited to 128 bytes.

(message).is_silent

boolean

Determines whether to send the message without any updates on its associated data. If true, then the channel's unread_message_count and last_message remain unchanged after the message has been migrated. (Default: false)

(message).mentioned_user_ids[]

array

Specifies an array of one or more IDs of the users who got a notification for the message.

(message).data

string

Specifies additional data that you stored for the message. This property can be the structured data such as a JSON object.

Request body example
Light Color Skin
Copy
{
    "messages": [
        {
            "message_type": "MESG",
            "user_id": "Danielle",
            "message": "Let's have some fun!",
            "custom_type": "notification",
            "mentioned_user_ids": ["Ki-eun", "Blair", "Jeff"],
            "timestamp": 1543420803841
        },
        {
            "message_type": "FILE",
            "user_id": "Blair",
            "url": "https://sendbird.com/main/img/emoji/smile_0012.jpg",
            "file_name": "Grinning Face with Big Eyes",
            "file_size": 256,
            "timestamp": 1543420803934
        },
        {
            "message_type": "ADMM",
            "message": "James entered the room.",
            "custom_type": "admin_welcome",
            "data": "invited by Danielle",
            "timestamp": 1543420804308
        }
    ]
}

Response

If successful, this action returns an empty response body.