Conversations
Channelize.io supports two types of conversations i.e 1-to-1 conversations and Private Group conversations. This section contains what all conversations related actions can be performed using Application APIs.
List Conversations
Retrieves the list of conversations of a user.
GET https://api.channelize.io/v1/conversations/
Query Params
The following table lists the parameters this API call supports to get filtered results.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
memberId | string | no | null | Restricts the search scope to only retrieve the target user's conversations. |
isGroup | boolean | no | null | Restricts the search scope to only retrieve private 1-to-1 or group conversations. If set to true, group conversations are returned. If set to false, private 1-to-1 conversations are returned in the response. |
includeDeleted | boolean | no | false | Determines whether to include deleted conversation in response. |
includeOnlyActive | string | no | false | Restricts the search scope to retrieve only conversations in which the user is active. |
sort | string | no | updatedAt DESC | Specifies the sorting criteria for the returned results. Allowed values are updatedAt ASC and updatedAt DESC. |
include | string | no | null | Specifies extra fields if you want extra information to be appended with the conversation objects. Allowed values are membersList and messages. |
limit | int | no | 25 | Specifies the number of results to return. |
skip | int | no | 0 | Specifies the number of results you want to skip from the beginning. (Useful in Pagination) |
Request Example
https://api.channelize.io/v1/conversations?includeDeleted=false&limit=10
Response
Status Code: 201
[
{
"id": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"title": "Avengers Group",
"memberCount": 30,
"isGroup": true,
"ownerId": "20697",
"profileImageUrl": null,
"createdAt": "2019-04-24T08:23:38.260Z"
},
{
"id":"a357c350-507e-11e9-9602-77ade703151b",
"title":"Untitled",
"memberCount":1,
"isGroup":false,
"ownerId":"20697",
"profileImageUrl":null,
"createdAt":"2019-03-27T10:54:04.805Z"
},
{
"id":"6f877f60-5d18-11e9-8c71-9b3ad3c868c4",
"title":"Roommates",
"memberCount":5,
"isGroup":true,
"ownerId":"20456",
"profileImageUrl":null,
"createdAt":"2019-04-12T11:45:14.326Z"
}
]
Create a Conversation
Creates a new conversation.
POST https://api.channelize.io/v1/conversations/
Body Params for Group Conversations
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
id | string | no | auto generated | The unique ID of the conversation. |
title | string | yes | - | The name of the conversation. |
profileImageUrl | string | no | null | The URL of the conversation's profile image. |
createdAt | string | no | null | The timestamp when the conversation was created. |
members | array | yes | - | Specifies an array of user IDs to add to the conversation. E.g. ["20236", "20697", "19116"] |
isGroup | boolean | no | true | Determines whether to create a group conversation or private 1-to-1 conversation. If set to true, group conversation will create. If set to false, a private 1-to-1 conversation will create. |
Body Parameters for 1-to-1 Conversation
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
id | string | no | auto generated | The unique ID of the conversation. |
createdAt | string | no | null | The timestamp when the conversation was created. |
members | array | yes | null | Specifies an array of user IDs to add to the conversation. E.g. ["20236", "20697", "19116"] |
isGroup | boolean | no | true | Determines whether to create a group conversation or private 1-to-1 conversation. If set to true, group conversation will create. If set to false, a private 1-to-1 conversation will create. |
Response
Status Code: 201
{
"id": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"title": "Soccer group",
"memberCount": 12,
"isGroup": true,
"ownerId": "20697",
"profileImageUrl": null,
"createdAt": "2019-04-24T08:23:38.260Z",
"membersList": [
{
"id": "42ab7450-666a-11e9-bdcd-0bf68210bf49",
"userId": "20697",
"chatId": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"lastSeenMessageId": "42c34213-666a-11e9-bdcd-0bf68210bf49",
"newMessageCount": 0,
"mute": false,
"isActive": true,
"isAdmin": true,
"isDeleted": false,
"lastMessageId": "42c34213-666a-11e9-bdcd-0bf68210bf49",
"updatedAt": "2019-04-24T08:23:38.417Z",
"user": {
"id": "20697",
"displayName": "Channelize Demo User",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/33/19/02/b5ceb45b2d6c74e4fc89673a5675c09c.jpg",
"isOnline": false,
"lastSeen": "2019-03-14T05:52:04.821Z"
},
"lastMessage": {
"id": "42c34213-666a-11e9-bdcd-0bf68210bf49",
"attachmentType": "text",
"contentType": 1,
"ownerId": "20697",
"metaMessageType": "meta_group_add_members",
"recipients": [
{
"id": "42c34210-666a-11e9-bdcd-0bf68210bf49",
"recipientId": "20697",
"status": 3,
"createdAt": "2019-04-24T08:23:38.417Z"
},
{
"id": "42c34211-666a-11e9-bdcd-0bf68210bf49",
"recipientId": "49",
"status": 3,
"createdAt": "2019-04-24T08:23:38.417Z"
}
],
"_metaMessageData": {
"id": "42c34212-666a-11e9-bdcd-0bf68210bf49",
"subType": "user",
"subId": "20697",
"objType": "users",
"objValues": [
"49"
]
},
"owner": {
"id": "20697",
"displayName": "Channelize Demo User",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/33/19/02/b5ceb45b2d6c74e4fc89673a5675c09c.jpg"
},
"tags": []
}
},
{
"id": "42ab7451-666a-11e9-bdcd-0bf68210bf49",
"userId": "49",
"chatId": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"lastSeenMessageId": null,
"newMessageCount": 0,
"mute": false,
"isActive": true,
"isAdmin": false,
"isDeleted": false,
"lastMessageId": "42c34213-666a-11e9-bdcd-0bf68210bf49",
"updatedAt": "2019-04-24T08:23:38.417Z",
"user": {
"id": "49",
"displayName": "Channelize Demo User 1",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/album_photo/41/eb/ea56_3b95.jpg",
"isOnline": false,
"lastSeen": "2019-04-23T07:49:38.311Z"
},
"lastMessage": {
"id": "42c34213-666a-11e9-bdcd-0bf68210bf49",
"attachmentType": "text",
"contentType": 1,
"ownerId": "20697",
"metaMessageType": "meta_group_add_members",
"recipients": [
{
"id": "42c34210-666a-11e9-bdcd-0bf68210bf49",
"recipientId": "20697",
"status": 3,
"createdAt": "2019-04-24T08:23:38.417Z"
},
{
"id": "42c34211-666a-11e9-bdcd-0bf68210bf49",
"recipientId": "49",
"status": 3,
"createdAt": "2019-04-24T08:23:38.417Z"
}
],
"_metaMessageData": {
"id": "42c34212-666a-11e9-bdcd-0bf68210bf49",
"subType": "user",
"subId": "20697",
"objType": "users",
"objValues": [
"49"
]
},
"owner": {
"id": "20697",
"displayName": "Channelize Demo User",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/33/19/02/b5ceb45b2d6c74e4fc89673a5675c09c.jpg"
},
"tags": []
}
}
]
}
Get a Conversation
Retrieves information about a conversation. You can also get additional details in the conversation object using include parameter.
GET https://api.channelize.io/v1/conversations/{conversation_id}
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation to retrieve. |
Query Params
The following table lists the parameters this API call supports to get filtered results.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
include | string | no | null | Specifies extra fields if you want extra information to be appended with the conversation objects. Allowed values are membersList and messages. |
Request Example
https://api.channelize.io/v1/conversations/42ab4d40-666a-11e9-bdcd-0bf68210bf49
Response
Status Code: 200
{
"id": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"title": "Soccer group",
"memberCount": 20,
"isGroup": true,
"ownerId": "20697",
"profileImageUrl": null,
"createdAt": "2019-04-24T08:23:38.260Z"
}
Get Conversation Count
Retrieves the total number of conversations of a user.
GET https://api.channelize.io/v1/conversations/count
Query Params
The following table lists the parameters this API call supports to get filtered results.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
isGroup | boolean | no | null | Determines whether to include group conversation count or private 1-to-1 conversation count. |
includeDeleted | boolean | no | false | Determines whether to include deleted conversation count. |
includeOnlyActive | boolean | no | false | Determines whether to include conversations count in which the user is active. |
Request Example
https://api.channelize.io/v1/conversations/count
Response
Status Code: 200
{
"count": 162
}
Get Messages
Retrieves the list of messages from a conversation.
GET https://api.channelize.io/v1/conversations/{conversation_id}/messages
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Query Params
The following table lists the parameters this API call supports to get filtered results.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
ownerId | string | no | null | The user ID of the message sender. |
contentType | int | no | null | Specifies the type of message. Allowed Values are 0, 1, 2 and 3 for text/media, meta message, sticker/gif and location messages respectively. |
attachmentType | string | no | null | Specifies the type of attachment. This is used to further filter the text/media contentType. Allowed values are text, image, video, audio . Multiple values can also be passed in attachmentType as comma separated values. |
sort | string | no | updatedAt DESC | Specifies the sorting criteria for the returned results. Allowed values are updatedAt ASC and updatedAt DESC. |
limit | int | no | 50 | Specifies the number of results to return. |
skip | int | no | 0 | Specifies the number of results you want to skip from the beginning. |
Request Example
https://api.channelize.io/v1/conversations/42ab4d40-666a-11e9-bdcd-0bf68210bf49/messages
Response
Status Code: 200
[
{
"id": "cbcf92b3-6661-11e9-bdcd-0bf68210bf49",
"chatId": "2f364950-497c-11e9-abc8-c9205832da08",
"attachmentType": "text",
"contentType": 1,
"status": "success",
"ownerId": "20697",
"metaMessageType": "meta_group_leave",
"recipients": [
{
"id": "cbcf6ba0-6661-11e9-bdcd-0bf68210bf49",
"recipientId": "21270",
"status": 3,
"createdAt": "2019-04-24T07:23:02.873Z"
},
{
"id": "cbcf92b0-6661-11e9-bdcd-0bf68210bf49",
"recipientId": "18859",
"status": 3,
"createdAt": "2019-04-24T07:23:02.873Z"
},
{
"id": "cbcf92b1-6661-11e9-bdcd-0bf68210bf49",
"recipientId": "20697",
"status": 3,
"createdAt": "2019-04-24T07:23:02.873Z"
}
],
"_metaMessageData": {
"id": "cbcf92b2-6661-11e9-bdcd-0bf68210bf49",
"subType": "user",
"subId": "20697",
"objType": "user"
},
"owner": {
"id": "20697",
"displayName": "Channelize Demo User",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/33/19/02/b5ceb45b2d6c74e4fc89673a5675c09c.jpg"
},
"tags": []
},
{
"id": "170e60ea-bfe7-4c6f-8e2c-db1fbf815c02",
"chatId": "2f364950-497c-11e9-abc8-c9205832da08",
"attachmentType": "text",
"contentType": 0,
"status": "success",
"body": "the",
"ownerId": "18859",
"recipients": [
{
"id": "49583010-4a0c-11e9-9b2a-21df0d211f59",
"recipientId": "21270",
"status": 1,
"createdAt": "2019-03-19T06:00:24.209Z"
},
{
"id": "49583011-4a0c-11e9-9b2a-21df0d211f59",
"recipientId": "20697",
"status": 3,
"createdAt": "2019-03-19T06:00:24.209Z"
},
{
"id": "49583012-4a0c-11e9-9b2a-21df0d211f59",
"recipientId": "18859",
"status": 1,
"createdAt": "2019-03-19T06:00:24.209Z"
}
],
"owner": {
"id": "18859",
"displayName": "Channelize Demo User 1",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/17/0a/02/fbef1bb47eb85fb2979b135ed04e0eb3.png"
},
"tags": []
}
]
Get Messages Count
Retrieves the total number of messages in a conversation.
GET https://api.channelize.io/v1/conversations/{conversation_id}/messages/count
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Body Params
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
ownerId | string | no | null | The user ID of the message sender. |
contentType | int | no | null | Specifies the type of message. Allowed Values are 0, 1, 2 and 3 for text/media, meta message, sticker/gif and location messages respectively. |
attachmentType | string | no | null | Specifies the type of attachment. This is used to further filter the text/media contentType. Allowed values are text, image, video, audio . Multiple values can also be passed in attachmentType as comma separated values. |
Request Example
https://api.channelize.io/v1/conversations/42ab4d40-666a-11e9-bdcd-0bf68210bf49/messages/count
Response
Status Code: 200
{
"count": 6
}
Get Members
Retrieves the list of users who are members of the conversation.
GET https://api.channelize.io/v1/conversations/{conversation_id}/members
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Request Example
https://api.channelize.io/v1/conversations/42ab4d40-666a-11e9-bdcd-0bf68210bf49/members
Response
Status Code: 200
[
{
"id": "42ab7450-666a-11e9-bdcd-0bf68210bf49",
"userId": "20697",
"chatId": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"lastSeenMessageId": "8a7fdff0-666f-11e9-bdcd-0bf68210bf49",
"newMessageCount": 0,
"mute": false,
"isActive": true,
"isAdmin": true,
"isDeleted": false,
"resourceType": "user",
"lastMessageId": null,
"updatedAt": "2019-04-24T09:01:26.254Z",
"user": {
"id": "20697",
"displayName": "Channelize Demo User",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/33/19/02/b5ceb45b2d6c74e4fc89673a5675c09c.jpg",
"isOnline": false,
"lastSeen": "2019-03-14T05:52:04.821Z"
}
},
{
"id": "42ab7451-666a-11e9-bdcd-0bf68210bf49",
"userId": "49",
"chatId": "42ab4d40-666a-11e9-bdcd-0bf68210bf49",
"lastSeenMessageId": "af54d982-666e-11e9-bdcd-0bf68210bf49",
"newMessageCount": 0,
"mute": false,
"isActive": true,
"isAdmin": true,
"isDeleted": false,
"resourceType": "user",
"lastMessageId": "8a7fdff0-666f-11e9-bdcd-0bf68210bf49",
"updatedAt": "2019-04-24T09:01:26.254Z",
"user": {
"id": "49",
"displayName": "Channelize Demo User 1",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/album_photo/41/eb/ea56_3b95.jpg",
"isOnline": false,
"lastSeen": "2019-04-23T07:49:38.311Z"
},
"lastMessage": {
"id": "8a7fdff0-666f-11e9-bdcd-0bf68210bf49",
"attachmentType": "text",
"contentType": 1,
"ownerId": "20697",
"metaMessageType": "meta_group_add_members",
"_tags": [],
"recipients": [
{
"id": "8a7fb8e1-666f-11e9-bdcd-0bf68210bf49",
"recipientId": "49",
"status": 3,
"createdAt": "2019-04-24T09:01:26.254Z"
},
{
"id": "8a7fb8e2-666f-11e9-bdcd-0bf68210bf49",
"recipientId": "18859",
"status": 3,
"createdAt": "2019-04-24T09:01:26.254Z"
},
{
"id": "8a7fb8e3-666f-11e9-bdcd-0bf68210bf49",
"recipientId": "20456",
"status": 3,
"createdAt": "2019-04-24T09:01:26.254Z"
}
],
"_metaMessageData": {
"id": "8a7fb8e4-666f-11e9-bdcd-0bf68210bf49",
"subType": "user",
"subId": "20697",
"objType": "users",
"objValues": [
"20456"
]
},
"owner": {
"id": "20697",
"displayName": "Channelize Demo User",
"profileImageUrl": "http://mobiledemodevelopment.s3.amazonaws.com/public/user/33/19/02/b5ceb45b2d6c74e4fc89673a5675c09c.jpg"
},
"tags": []
}
},
]
Add Members
Adds a member to the conversation.
POST https://api.channelize.io/v1/conversations/{conversation_id}/add_members
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Body Parameters
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
members | array | yes | - | Specifies an array of user IDs to add to the conversation. E.g. ["20236", "20697", "19116"] |
Response
Status Code: 204
No Content
Remove Members
Removes a member from the conversation.
POST https://api.channelize.io/v1/conversations/{conversation_id}/remove_members
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Body Params
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
members | array | yes | - | Specifies an array of user IDs to remove from the conversation. E.g. ["20236", "20697", "19116"] |
Response
Status Code: 204
No Content
Add Admin
Grants group admin permission to a user. Only an existing member/participant of the group can be admin of the group conversation.
PUT https://api.channelize.io/v1/conversations/{conversation_id}/add_admin
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Body Params
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
userId | string | yes | null | The unique ID of the user who is going to be the new group conversation admin. |
Response
Status Code: 204
No Content
Clear Conversation
Clears a targeted conversation.
DELETE https://api.channelize.io/v1/conversations/{conversation_id}/clear
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation to clear. |
Response
Status Code: 204
No Content
Delete Conversation
Deletes a targeted conversation. This API lets you delete the copy of a conversation for a user. For other members of the conversation, this conversation will still appear, and hence the conversation is not hard-deleted from the database.
DELETE https://api.channelize.io/v1/conversations/{conversation_id}/delete
Path Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation to delete. |
Response Body
Status Code: 204
No Content
Leave a Conversation
Leaves the targeted conversation for a user.
POST https://api.channelize.io/v1/conversations/{conversation_id}/leave
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation to leave. |
Response
Status Code: 204
No Content
Mark Messages Read
Mark all messages 'Read' in a targeted conversation for a user.
PUT https://api.channelize.io/v1/conversations/{conversation_id}/mark_all_as_read
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation in which messages are to be marked Read. |
Response
Status Code: 204
No Content
Update Title
Updates the title of a group conversation.
PUT https://api.channelize.io/v1/conversations/{conversation_id}/update_title
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation to update. |
Body Params
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
title | string | yes | null | Specifies the title for the conversation. |
Response
Status Code: 204
No Content
Update Profile Image
Updates the profile image of a group conversation.
PUT https://api.channelize.io/v1/conversations/{conversation_id}/update_profile
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation to update. |
Body Params
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
profileImageUrl | string | no | null | Specifies the profile image URL of the conversation. |
Response
Status Code: 204
No Content
Update Settings
Updates the settings of a targeted conversation. These settings include mute conversation settings.
PUT https://api.channelize.io/v1/conversations/{conversation_id}/update_settings
Path Params
This table lists all possible parameters this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
conversation_id | string | yes | - | The unique ID of the conversation. |
Body Params
This table lists all possible parameters body of this API request supports.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
settings | Object | yes | null | Specifies the JSON object in key value format. Allowed values are: { mute: true } or { mute: false } |
Response
Status Code: 204
No Content