Retrieve Recent Chats

Get Recent Chats#

To get all the list of recent chats, send a request to the server as described below.

await SDK.getRecentChats();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString
dataArray of Object datasArray

Response Format:#

data: [
{
archiveStatus: 0, // Number - Archive Status
chatType: "", // String - Chat Type "chat"/"groupchat"
createdAt: "", // String - Created Time
deleteStatus: "", // Number - Delete Status (Recall)
fromUserId: "", // String - From User Id
isLastMessageSentByMe: true, // Boolean - lastMessage sent by me 'true', otherwise 'false'
metaData: {}, //Object - Meta data for the message
msgBody: {
media: { // For Media Message Only
androidHeight: 188, // Number - Android Height -Only For Image/Video
androidWidth: 250, // Number - Android Width -Only For Image/Video
caption: "", // String - Media Caption
duration: 0, // Number - Duration - For Audio/Videos
fileName: "", // String - File Name
file_key: "", // String - File Key
file_size: 543879, // Number - File Size
file_url: "", // String - File Url
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
msgId: "", // String - MessageId
originalHeight: 240, // Number - Original Height -Only For Image/Video
originalWidth: 320, // Number - Original Width -Only For Image/Video
thumb_image: "", // Base64 - Thumb Image
webHeight: 248, // Number - Web Height -Only For Image/Video
webWidth: 330 // Number - Web Width -Only For Image/Video
}
mentionedUsersIds: [], // Array - Mentioned Ids For groupChat
message: "", // String - Message Body
message_type: "" // String - Message Type
nickName: "Rizwan" // String - User Name
},
msgId: "", // String - Unique Message Id
msgStatus: "", // Number - Message Status
msgType: "", // String - Message Type
muteStatus: 0, // Number - Mute Status
publisherId: "", // String - Publisher Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
toUserId: "", // String - To User Id
topicId: "", //String - Topic id for the message
unreadCount: "", // Number - Unread Message Count
updatedAt: "", // String - Updated Time
userId: "", // String - Notification To
},
//...
];