Recent chat

To retreive the topic based recent chat data 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/topic/recent?topicIds=xxxx&page=1&size=10"
-H "accept: */*"
-H "Authorization: AuthToken"

Request Params#

ParamDataTypeRequiredDescription
topicIdsArray of StringYesList of TopicIds to fetch chats associated with each TopicId
pageNumberNoPage number to get the particular page data default value is 1
sizeNumberNoNumber of chats per page default value is 10

Note : Topics can be created from here Create Topic

Responses#

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

{
"status": 200,
"data": {
"chatList": [
{
"chatType": "samplechattype", // String - Possible values are singlechat, groupchat
"messageType": "samplemessagetype", // String - Message type such as text, image, file, audio, video, contact, location, notification
"messageId": "xxxxxx", // String - Unique id of this message - auto genereted
"message": "samplemessage", // String - Actual message text or notification code
"deliveryStatus": 0, // Number - Message delivery status
"fromUser": "99xxxxxx22", // String - Sender userid
"fromUserName": "sampleusername", // String - Sender nickname
"toUser": "99xxxxxx00", // String - Receiver userid
"toUserName": "sampleusername", // String - Receiver nickname
"participantName": "sampleusername", // String - Participant nickname
"media":{
"caption": "", // String - caption for uploaded video
"fileKey": "", // String - key to encrypt/decrypt for uploaded file
"fileName": "samplefilename", // String - name of the uploaded file
"fileUrl": "xxxxxx", // String - token of the uploaded file to cloud
},
"location": {
"latitude": "",// String - location latitude
"longitude": "",// String - location longitude
"mid": "",// String - mid
"locationResolvedKey": ""// String - locationResolvedKey
},
"contact": {
"contactResolvedKey": "",// String - contactResolvedKey
"mid": "",// String - mid
"name": "samplename",// String - contact name
"phoneNumber": [
"99xxxxxx11"// String - contact number
]
},
"id": 0, //Number - unique id for this record
"messageTime": 0, // Number - sentTime as epoch timestamp
"topicId": "xxxxxx" // String - topicId
}
],
"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"
}