cometchat / chat-sdk-javascript

Voice & Video Calling and Text Chat SDK for JavaScript/Web
Other
30 stars 24 forks source link

How to fetch all conversations history, rather then by previous messages related to user? #49

Closed Mike-Van closed 4 years ago

mayur-bhandari commented 5 years ago

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 5 years ago

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 4 years ago

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 4 years ago

Closing this issue due to inactivity.