Conversation
object information of one or multiple specified conversations.getConversationProfile
.chat.getConversationList(options);
Name | Type | Description |
options | undefined | Array | Object | If options is undefined, the SDK will return all the conversations. if options is of the Array type, it shall not be empty, the SDK will return specified conversations. if options is of the Object type, as {type, markType, groupName}, the SDK will return filtered conversations. |
Promise
let promise = chat.getConversationList();promise.then(function(imResponse) {// This full conversation list will overwrite the original conversation list.const conversationList = imResponse.data.conversationList;// Whether synchronizing the conversation list from the cloud is completedconst isSyncCompleted = imResponse.data.isSyncCompleted;}).catch(function(imError){console.warn('getConversationList error:', imError); // Error information});
// Get the list of specified conversationslet promise = chat.getConversationList([conversationID1, conversationID2]);promise.then(function(imResponse) {// List of specified conversations that already exist in the cacheconst conversationList = imResponse.data.conversationList;}).catch(function(imError){console.warn('getConversationList error:', imError); // Error information});
// Get all group conversationslet promise = chat.getConversationList({ type: TencentCloudChat.TYPES.CONV_GROUP });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList; // Conversation list});
// Obtain all conversations that are marked as "favorite"let promise = chat.getConversationList({ markType: TencentCloudChat.TYPES.CONV_MARK_TYPE_STAR });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList; // Conversation list});
// Obtain all conversations in a specified conversation grouplet promise = chat.getConversationList({ groupName: 'Suppliers' });promise.then(function(imResponse) {const conversationList = imResponse.data.conversationList; // Conversation list});
chat.getConversationProfile(conversationID);
Name | Type | Description |
conversationID | String | Conversation ID. Valid values: C2C${userID} (for a one-to-one chat) GROUP{groupID} (for a group chat) @TIM#SYSTEM (for a system notification conversation) |
Promise
let promise = chat.getConversationProfile(conversationID);promise.then(function(imResponse) {// Conversation profile 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?