Recent Chat

To retreive all recent chat data of a user you can use the below API.

info

{api-base-url} can be obtained from the MirrorFly console.

HTTP request#

curl -X GET "https://{api-base-url}/api/v1/chat/admin/chatlogs/recent?userId=xxxx&page=1&size=10"
-H "accept: */*"
-H "Authorization: AuthToken"

Request Params#

ParamDataTypeRequiredDescription
userIdStringYesuserId to fetch recent chats of a user
pageNumberNoPage number to get the particular page data default value is 1
sizeNumberNoNumber of chats per page default value is 10

Responses#

If successful, this action returns recent chats list in the response body.

{
"status": 200,
"data": {
"chatList": [
{
"fromUser": "xxxxxx", // String - Sender userId
"fromUserName": "sample username", // String - Sender nickname
"toUser": "xxxxxx", // String - Sender userId
"toUserName": "sample username", // String - Sender nickname
"participant": "xxxxxx", // String - Participant userId or groupId of chat
"participantName": "samplename", // String - Participant nickname
"chatType": "samplechattype", // String - Possible values are singlechat, groupchat
"message": "samplemessage", // String - Actual message text or notification code
"messageType": "samplemessagetype", // String - Message type such as text, image, file, audio, video, contact, location, notification
"messageTime": 0 // Number - sentTime as epoch timestamp
}
],
"totalPages": 1, // Number - Total pages based on the size
"totalRecords": 1 // Number - Total chats for the logged-in user
},
"message": "Data retrieved successfully"
}

Error#

In the case of an error, an error object like below is returned.

When the token passed in Headers is expired

{
"status": 401,
"message": "Token Expired"
}

In the case of a Bad Request, an error message is returned

{
"status": 400,
"message": "Error Message"
}