Get Conversation
LikeMinds React Native Chat SDK offers this feature which enables you to access and analyze individual conversations, empowering you to implement customized functionalities or perform specific operations within your chat application.
Steps to Get a Single Conversation
- 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("ENTER_CHATROOM_ID")
.setPage("ENTER_REQURIED_PAGE_NO")
.setMinTimestamp("ENTER_MIN_TIMESTAMP")
.setMaxTimestamp(Date.now())
.setPageSize("ENTER_PAGE_SIZE")
.setConversationId("ENTER_CONVERSATION_ID")
.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 |
---|
| 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 | |