Migrating to Sendbird
Sendbird provides convenient APIs to ensure a smooth transition of your chat services to Sendbird. Follow these essential steps to migrate your data from an existing provider or in-house solution. This process involves mapping your current data types to those supported by Sendbird.
1. Register users
Begin by migrating your users to the Sendbird system. Utilize the user creation API to register each user from your current chat solution to your Sendbird application.
2. Create a channel
Sendbird requires you to manually create a channel to house your messages. Sendbird Chat provides three types of channels:
Note: This step is crucial as channels are not automatically created for your data migration.
3. Migrate messages
Once your channels are set up, use the migrate message API to transfer your existing messages to Sendbird.
Note: The migrate message API allows a maximum of 100 messages per migration request. If you are migrating a large volume of data, contact Sendbird support to adjust migration rate limits for your application.
Register users
Before creating a channel or migrating messages, you must register your users with Sendbird. This process involves mapping your existing user data to Sendbird's user data structure.
Note: If you have plans to migrate users who are deactivated, you have to make a separate API call to deactivate the user after migrating.
HTTP request
Request body
The following table lists the properties of an HTTP request that this action supports.
Properties
Required | Type | Description |
---|---|---|
user_id | string | Specifies a user's unique ID. Maximum length is 80 characters. |
nickname | string | Specifies the user's nickname. Maximum length is 80 characters. |
profile_url | string | Specifies the URL of the user's profile image. If left empty, no profile image is set for the user. Maximum length is 2,048 characters. If the |
profile_file | binary | Specifies the file of the user's profile image. An acceptable image is limited to a JPG, JPEG, or PNG file of up to 5 MB. When passing a file, you should send a multipart request. If the |
Optional | Type | Description |
---|---|---|
issue_access_token | boolean | Determines whether to create an access token for the user. If set to |
metadata | nested object | Specifies a |
| boolean | (Deprecated) Determines whether to create a session token for the user. If set to |
| long | (Deprecated) Specifies the time for the issued session token to expire in Unix milliseconds format. The length should be 13. If a value of this property is not specified and the |
Responses
If successful, this action returns a user resource in the response body.
Error
In the case of an error, an error object like below is returned. See the error codes section for more details.
Create channels
After you have migrated your users you will need to migrate your channels. Sendbird has three types of channels: open, group, and supergroup channels.
Note: If you have frozen channels or read-only channels, you need to freeze the channel after migrating.
Creating an open channel
The following is an API implementation to create an open channel.
HTTP request
Request body
The following table lists the properties of an HTTP request that this action supports.
Optional
Property name | Type | Description |
---|---|---|
name | string | Specifies the channel topic, or the name of the channel. The length is limited to 191 characters. (Default: |
channel_url | string | Specifies the URL of the channel. Only numbers, letters, underscores, and hyphens are allowed. The allowed length is 4 to 100 characters, inclusive. If not specified, a URL is automatically generated. |
cover_url | string | Specifies the URL of the channel's cover image. The length is limited to 2,048 characters. |
cover_file | file | Uploads a file for the channel's cover image. |
custom_type | string | Specifies the custom channel type which is used for channel grouping. The length is limited to 128 characters. |
data | string | Specifies additional channel information such as a long description of the channel or |
is_ephemeral | boolean | Determines whether to preserve messages in the channel to later retrieve the chat history. If set to |
boolean | Determines whether the channel to be created is an open channel based on a dynamic partitioning structure. The value of | |
operator_ids[] | array of strings | Specifies an array of user IDs to register as operators of the channel. The maximum number of operators allowed per channel is 100. Operators can delete any messages in the channel and receives all messages that have been throttled. |
| array of strings | (Deprecated) Specifies the string IDs of the users registered as channel operators. Operators can delete any messages in the channel and even receive all messages that have been throttled. |
Note: If you want to upload a profile picture by passing an image
file
instead of a URL, see Multipart requests.
Responses
If successful, this action returns an open channel resource in the response body.
Error
In the case of an error, an error object like below is returned. See the error codes section for more details.
Creating a group channel
The following is an API implementation to create a group channel.
HTTP request
Request body
The following table lists the properties of an HTTP request that this action supports.
If you are creating a 1-to-1 direct messaging channel, it is recommended that you set the value of is_distinct
to true
. If is_distinct
is set to false
, a new channel is created even for users with shared chat history and all previous conversations will be lost. On the other hand, if the is_distinct
property is set to true
, no new channel is created for users with shared chat history, and every 1-to-1 conversation between the same two users will continue in the existing channel.
Properties
Required | Type | Description |
---|---|---|
users | array of objects | Specifies an array of one or more user objects to invite to the channel. Up to 100 users can be invited at a time. Specify a value for either |
Optional | Type | Description |
---|---|---|
user_ids | array of strings | Specifies an array of one or more IDs of users to invite to the channel. Up to 100 users can be invited at a time. Specify a value for either |
name | string | Specifies the name of the channel, or the channel topic. The length is limited to 191 characters. (Default: |
channel_url | string | Specifies the URL of the channel. Only numbers, letters, underscores, and hyphens are allowed. The allowed length is 4 to 100 characters, inclusive. If not specified, a URL is automatically generated. |
cover_url | string | Specifies the URL of the channel's cover image. This should be no longer than 2,048 characters. |
cover_file | file | Uploads an image file of your choice to be used as the channel's cover image. If you want to upload a picture by passing an image file instead of a URL, see Multipart requests. |
custom_type | string | Specifies a custom channel type which is used for channel grouping. Maximum length is 128 characters. |
data | string | Additional channel information such as a long description of the channel or |
is_distinct | boolean | Determines whether to reuse an existing channel or create a new channel when attempting to create a channel with the same group of members. By default, a new channel is created even if one already exists for the same members. You can override this and force an existing channel to be returned by setting a value of |
is_public | boolean | Determines whether to allow users to join the channel without an invitation. By default, a user must be invited to join a group channel. It is possible to allow any user to join a group channel without an invite by setting |
is_super | boolean | Determines whether to allow the channel to accommodate 100 or more members. By default, a group channel has a member limit of 100. A Supergroup channel must be used in order to have more than 100 channel members. A Supergroup channel has a member limit of 2000. |
is_ephemeral | boolean | Determines whether to preserve messages in the channel for the purpose of retrieving chat history. By default, all chat messages will be stored by Sendbird. This means that chat histories can easily be retrieved when using the SDK or API. |
access_code | string | Specifies an access code that is only applicable to public group channels. If a value is specified for |
inviter_id | string | Specifies the ID of a user who invites other users to the channel. The inviter isn't automatically registered to the channel as a member, so you should specify the ID of the inviter in the |
strict | boolean | Determines whether to receive a |
invitation_status | object | Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. |
hidden_status | object | Specifies one or more key-value pair items which set the channel's hidden status for each user. |
operator_ids[] | array of strings | Specifies an array of one or more IDs of users to register as operators of the channel. You should also include these IDs in the |
block_sdk_user_channel_join | boolean | Determines whether to block users from joining the channel through the Chat SDK. If set to |
Responses
If successful, this action returns a group channel resource in the response body.
Note : The
role
property in each user resource under themember
property indicates whether the user is a channel operator or a channel member.
Transfer messages
The final stage of migration is to migrate your messages to Sendbird. Sendbird has three message types: User Message, File Message, and Admin Message. Each request can migrate 100 messages to a given channel.
See the Migrate messages page for API details.