How to fetch all conversations history, rather then by previous messages related to user?
Closed this issue · 4 comments
mike-van commented
How to fetch all conversations history, rather then by previous messages related to user?
mayur-bhandari commented
Hello @mike-van , you can fetch all the messages from all conversations i.e one-on-one and group conversation as follow:
var limit = 50;
var messagesRequest = new CometChat.MessagesRequestBuilder().setLimit(limit).build();
messagesRequest.fetchPrevious().then(
messages => {
console.log("Message list fetched:", messages);
},error => {
console.log("Message fetching failed with error:", error);
}
);
mike-van commented
Hi @mayur-bhandari yes i saw this in the documentations, but this only fetch the array of messages send and received by logged in user, i want to fetch the array of dialogs related to the user. if i use this, i'd have to group them into seperate dialog, and order them by timestamp before getting all the dialogs.
mayur-bhandari commented
Hello @mike-van , we have added a functionality to fetch all the conversation the logged in user is part of. You can know more about Conversations here: https://prodocs.cometchat.com/v2.0/docs/js-messaging-retrieve-conversations
mayur-bhandari commented
Closing this issue due to inactivity.