Get Conversations
Simplify your chat application development with LikeMinds React Native Chat SDK. Enhance user conversations, enable real-time messaging, and provide seamless communication experiences with minimal coding effort. By utilizing this feature you can view all the conversations in the chatroom.
Steps to fetch Conversations inside a Chatroom
- Create a
syncConversationRequest
object usingSyncConversationRequest.builder
class by passing all the required parameters. - Call
syncConversation()
function using the instance oflmChatClient
. - Process the response
LMResponse<SyncConversationResponse>
as per your requirement.
const syncConversationRequest = SyncConversationRequest.builder()
.setChatroomId(86490)
.setPage(1)
.setMinTimestamp(0)
.setMaxTimestamp(Date.now())
.setPageSize(500)
.build();
const repsonse = lmChatClient?.syncConversation(syncConversationRequest);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Sync Conversation Payload
List of parameters provided by syncConversation()
.
Variable | Type | Description | Optional |
---|---|---|---|
chatroomId | number | chatroom Id | |
conversationId | number? | conversation id for which you want to get the conversation | ✔️ |
page | number | page number | |
pageSize | number | page size for paginated response | |
maxTimestamp | number | maximum timestamp | |
minTimestamp | number | minimum timestamp |
Sync Conversation Response
List of parameters in the response.
Variable | Type | Description | Optional |
---|---|---|---|
success | boolean | API success status | |
error_message | string | Error message in case of failure | ✔️ |
userMeta | Member | User data | |
conversationMeta | Conversation | Conversation data | |
conversationData | Conversation[] | List of conversations | |
communityMeta | Community | Community data | |
chatroomsMeta | Chatroom | Chatroom data | |
chatroomReactionsMeta | ReactionMeta[] | List of reactions | |
convReactionsMeta | ReactionMeta[] | List of reactions | |
convAttachmentsMeta | Attachment[] | List of attachments | |
convPollsMeta | Poll[] | List of Polls |