Conversation
object information of one or multiple specified conversations.getConversationProfile
.isSyncCompleted
of this API is used to indicate whether the synchronization of the conversation list from the cloud has been completed.chat.getConversationList(options);
Name | Type | Description |
options | undefined | Array | Object | Parameter options. If options are not passed, it means all conversations are retrievedIf a non-empty array parameter is passed in, it indicates to get multiple specified conversations Passing { type, markType, groupName, hasUnreadCount, hasGroupAtInfo } in the options means filtering the conversation list according to these conditions. |
Promise
// Get the full conversation listlet promise = chat.getConversationList();promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;}).catch(function(imError) {console.warn('getConversationList error:', imError); // Failed to obtain the conversation list});
// Get the list of specified conversationslet promise = chat.getConversationList([conversationID1, conversationID2]);promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;}).catch(function(imError) {console.warn('getConversationList error:', imError); // Failed to obtain the conversation list});
// Get all group conversations let promise = chat.getConversationList({ type: TencentCloudChat.TYPES.CONV_GROUP }); promise.then(function(imResponse) { const conversationList = imResponse.data.conversationList; });
// Get all "starred" conversationslet promise = chat.getConversationList({ markType: TencentCloudChat.TYPES.CONV_MARK_TYPE_STAR });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;});
// Get all unmarked conversationslet promise = chat.getConversationList({ markType: 0 });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;});
// Get all conversations under a specified conversation grouplet promise = chat.getConversationList({ groupName: 'Suppliers' });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;});
// Get all conversations that do not belong to any grouplet promise = chat.getConversationList({ groupName: '' });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;});
// Get all conversations with unread countslet promise = chat.getConversationList({ hasUnreadCount: true });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;});
// Get conversations that include group @messageslet promise = chat.getConversationList({ hasGroupAtInfo: true });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList;});
chat.getConversationProfile(conversationID);
Name | Type | Description |
conversationID | String | Conversation ID. Conversation ID formation method: C2C${userID} (Private chat)GROUP{groupID} (Group Chat)@TIM#SYSTEM (System Notification Session) |
Promise
let promise = chat.getConversationProfile(conversationID);promise.then(function(imResponse) {// Obtained successfullyconsole.log(imResponse.data.conversation); // Conversation profile}).catch(function(imError) {console.warn('getConversationProfile error:', imError); // Failed to obtain the conversation profile});
Was this page helpful?