Migration
Setting up Channelize.io and migrating your users, messages & their relationships from your main application or existing chat application to Channelize.io services is very easy. This section will help you complete the migration quickly.
Export
The first step is downloading an export of your data from your main application or existing chat application. This process takes typically a few hours to a few days depending on the size of data you're exporting.
Import
Follow the below steps to import the downloaded export file:
- Create a .zip file containing JSON files of the data exported. (Full file reference below).
- Share the file with the Channelize Support team at support@channelize.io to import to your Channelize services.
- Post validating the file, the Channelize support team will import the data and update you post data migration. Migration takes typically a few hours to a few days depending on the size of data you're exporting.
The .zip file which will contain the following JSON data files:
user.json - Data of users & their relationships with other users i.e friends list, following list and blocked lists.
conversation.json - Existing conversations in the Application.
message.json - Existing messages in the Application.
The structure of these JSON files is explained below. The .zip file should always have a customer.json file. The rest two JSON files are not mandatory. Find below the structure of created JSON files for data import:
File Patterns
User's JSON Pattern
User's data should be held in customer.json file in below format.
Parameter | Type | Required | Description |
---|---|---|---|
_id | string | yes | The unique ID of the user. This ID should be same as in your database to sync with Channelize.io. |
string | no | The email address of user. | |
displayName | string | yes | The user's name. |
profileImageUrl | string | no | The URL of user's profile image. |
profileUrl | string | no | The unique URL of user's profile. |
isOnline | boolean | yes | Indicates if user is online or offline. Set value to false while migrating the data. |
notification | boolean | yes | Indicates if notifications are enabled for user. |
visibility | boolean | yes | Indicate user's visibility setting. |
language | string | yes | Specifies the code of language to translate the text phrases used in User Interface. |
lastSeen | Date object | yes | Indicates when the user was online. |
role | string | yes | The accepted values are user and bot. For normal users, set this with "user" |
config | object | no | The bot's configuration which includes callbackUrl & aiPlatform. Please visit [Bot Integration].(platform-api-bot-integration-api/#create-bot) |
friends | Array | no | Specifies an array of one or more unique IDs of the users who are a friend/connection of a user. If there are no friends pass an empty array. |
blocks | Array | yes | Specifies an array of one or more unique IDs of the users who are a blocked by a user. If there are no blocked users pass an empty array. |
isActive | boolean | yes | Specifies if a user is active or not. Set value to true while migrating the data. |
isDeleted | boolean | yes | Specifies if a user is deleted or not. Set value to false while migrating the data. |
createdAt | Date object | yes | The timestamp when the user was created. |
updatedAt | Date object | yes | The timestamp when the user's details were updated. |
{
"_id": "20697",
"email" : "demouser99@channelize.io",
"displayName": "Channelize Demo User",
"profileImageUrl": "https://sample-file-url/media/b5ceb45b2d6c74e4fc89673a5675c09c.jpg",
"profileUrl": "http://devaddons1.socialengineaddons.com/mobiledemodevelopment/profile/test1",
"isOnline": true,
"notification": false,
"visibility": true,
"language": "en",
"lastSeen": {
"$date": "2019-01-02T19:21:16+00:00"
},
"createdAt": {
"$date": "2019-01-02T19:21:16+00:00"
},
"updatedAt": {
"$date": "2019-01-02T19:21:16+00:00"
},
"friends": [
"18751",
"18859",
"19133",
"19856",
],
"blocks":[],
"isDeleted": false,
"isActive": true,
"role": "user"
}
Conversation's JSON Pattern
Conversation's data should be held in conversation.json file in below format.
Parameter | Type | Required | Description |
---|---|---|---|
_id | string | yes | The unique ID of the conversation. This ID should be same as in your database to sync with Channelize.io |
type | string | yes | The conversation type. Allowed values are private, public . |
customType | string | no | Specify the custom type of conversation which is used for grouping like messaging , live_streaming , gaming etc. |
title | string | no | The title of the conversation. It is required for group conversation. For 1-to-1 conversations, you can set this null |
isGroup | boolean | yes | Determines whether it is a group conversation or a 1-to-1 conversation. Acceptable values are true and false. |
memberCount | number | yes | Specifies the number of members in a conversation. |
profileImageUrl | string | no | The URL of the conversation's profile image. |
ownerId | string | yes | The unique ID of the user who is the owner of the conversation. For 1-to-1 conversations, you can set this null. |
_members | array | yes | Specifies an array of conversation member JSON object. |
lastReadAt | object | yes | The timestamps of when each user has last read the messages in the conversation, in Date object. Each key-value pair has a key with the unique ID of a user and a value with the user’s timestamps. You can set with current timestamp |
createdAt | Date object | yes | The timestamp when the conversation was created. |
JSON object of a conversation member.
Parameter | Type | Required | Description |
---|---|---|---|
userId | string | yes | The unique ID of the conversation member. |
isActive | boolean | yes | Indicates whether the user still exists in the conversation. |
lastMessageId | string | yes | Indicates the unique ID of the last message for a user the the conversation. |
mute | boolean | yes | Determines whether the conversation mute setting is enabled for a user. |
resourceType | string | yes | Indicates the member's resource type. Set it user for now. |
updatedAt | Date object | yes | Indicates the timestamp when the conversation was updated for a user. |
isAdmin | boolean | yes | Determines if a user is Admin of the conversation. For 1-to-1 conversations set this value false for all members. |
unreadMessageCount | number | yes | The number of unread messages for a user in the conversation. |
isDeleted | boolean | yes | Indicates whether the conversation is deleted for a user. |
{
"_id" : "1021",
"type" : "private",
"customType" : "messaging",
"title" : "Test Group",
"isGroup" : true,
"memberCount" : 3,
"profileImageUrl" : "https://sample-file-url/media/Image-8664.jpg",
"ownerId" : "18646",
"metaData": [],
"lastReadAt": {
"18646": {"$date": "2020-01-29T06:48:53+00:00"},
"18664": {"$date": "2020-01-29T07:12:41+00:00"},
"18714": {"$date": "2020-01-29T07:12:41+00:00"}
},
"_members" : [
{
"id" : "89c7e350-4265-11ea-9c07-831a487bf6af",
"userId" : "18646",
"unreadMessageCount" : 0,
"mute" : false,
"isActive" : true,
"isAdmin" : true,
"isDeleted" : false,
"resourceType" : "user",
"lastMessageId" : "96840f0d-d067-4cd3-9381-400e5ece940b",
"updatedAt" : {
"$date": "2020-01-29T08:18:21+00:00"
}
},
{
"id" : "89c7e351-4265-11ea-9c07-831a487bf6af",
"userId" : "18664",
"unreadMessageCount" : 1,
"mute" : false,
"isActive" : true,
"isAdmin" : false,
"isDeleted" : false,
"resourceType" : "user",
"lastMessageId" : "96840f0d-d067-4cd3-9381-400e5ece940b",
"updatedAt" : {
"$date": "2020-01-29T08:18:21+00:00"
}
}
{
"id" : "89c7e352-4265-11ea-9c07-831a487bf6af",
"userId" : "18714",
"unreadMessageCount" : 1,
"mute" : false,
"isActive" : true,
"isAdmin" : false,
"isDeleted" : false,
"resourceType" : "user",
"lastMessageId" : "96840f0d-d067-4cd3-9381-400e5ece940b",
"updatedAt" : {
"$date": "2020-01-29T08:18:21+00:00"
}
}
],
"createdAt" : {
"$date": "2018-05-02T19:21:16+00:00"
}
}
Message's JSON Pattern
Message's data should be held in message.json file in below format.
Parameter | Type | Required | Description |
---|---|---|---|
_id | string | yes | The unique ID of the message. This id should be same as in your database to sync with Channelize.io |
conversationId | string | Yes | The unique ID of the conversation where the message is sent to. |
type | string | yes | Specify the type of message. Allowed values are normal,reply,forward,admin . |
customType | string | no | Specify the custom type of message which is used for grouping of messages. |
body | string | no | The content of the message. |
parentId | string | no | The ID of the parent message, if the message is a reply. |
replyCount | number | no | Specify the total number of replies to the message. |
showInConversation | boolean | no | Specify the showInConversation value of message. |
ownerId | string | yes | The unique ID of sender. |
_mentionedUsers | array | yes | Specify users mentioned in the message. If there is no mentioned users, set this to []. |
recipients | array | yes | Specifies an array of message recipient user IDs. Like: ["USER_ID_1", "USER_ID_2"] |
attachments | array | no | A list of attachments (text, image, audio, video, document, location, gif and sticker). If there is no attachment, set this to []. |
reactionsCount | object | no | Specifies an object of message reaction type with the count. Like: {"unlike": 2} |
reactions | object | no | Specifies an object of message reaction type with the user IDs array. Like: {"unlike": ["USER_ID_1", "USER_ID_2"]} |
isDeleted | boolean | yes | Determine to whether the message is deleted or not. Set this to false while migrating. |
encrypted | boolean | yes | Determine to whether the message is encrypted or not. Set this to false while migrating. |
createdAt | date | yes | The creation time of message. |
updatedAt | date | yes | The timestamp when the message was updated. You can also set createdAt value here. |
Mentioned user's JSON object
Parameter | Type | Required | Description |
---|---|---|---|
userId | string | Yes | User ID of mentioned user. |
order | number | yes | Mention user's order in the message in reference to another mentioned user |
wordcount | number | yes | Mentioned user's name word count. |
[
{
"wordCount": 2, // Mentioned user's name word count
"order": 1, // Mention user's order in the message in reference to another mentioned user.
"userId": "USER_ID" // User ID of mentioned user
},
{
"wordCount": 2,
"order": 2,
"userId": "USER_ID"
}
]
NOTE: If you want to build your own UI, the API allows type
field value different apart from supported by our UI components. Moreover you are able to send extra keys as well as different keys in attachments apart from supported by our UI components. If you take type
field value different and different extra keys, our UI components will not be supporting attachments well.
Message Attachment JSON Object Image/Video/Image/File
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | yes | null | Specifies the type of attachment like image, video, location, gif, sticker, text etc. This value can be different. |
fileUrl | string | yes | null | The url of original file. |
name | string | yes | null | The name of file. |
mimeType | string | yes | null | The mime type of file. |
extension | string | yes | null | The extension of file. |
size | number | yes | null | The size of file. |
thumbnailUrl | string | yes | null | The url of thumbnail file. |
customType | string | no | null | The cusom type of attachment. |
{
"type": "image",
"fileUrl": "https://sample-file-url/1576213941566-unnamed.jpg",
"name": "unnamed.jpg",
"mimeType": "image/jpeg",
"extension": "jpg",
"size": 95860,
"thumbnailUrl": "https://sample-file-url/media/1576213941566-unnamed-thumbnail.png",
"id": "5df31dba3a22d30037d62066"
}
{
"_id": "5a928b10-4258-11ea-9c07-831a487bf6af",
"conversationId": "1021",
"type": "normal",
"customType": "text",
"isDeleted": false,
"encrypted": false,
"createdAt": {
"$date": "2020-01-29T05:29:43+00:00"
},
"updatedAt": {
"$date": "2020-01-29T05:29:43+00:00"
},
"body": "hi",
"ownerId": "20697",
"recipients" : [
"18859",
"20697"
],
"attachments": [
{
"type": "image",
"fileUrl": "https://sample-file-url/1576213941566-unnamed.jpg",
"name": "unnamed.jpg",
"mimeType": "image/jpeg",
"extension": "jpg",
"size": 95860,
"thumbnailUrl": "https://sample-file-url/media/1576213941566-unnamed-thumbnail.png"
}
],
"_mentionedUsers": [
{
"wordCount": 2,
"order": 1,
"userId": "18845"
},
{
"wordCount": 2,
"order": 2,
"userId": "15432"
}
]
}