chat.deleteConversation(options);
Name | Type | Description |
options | String | Object | If the options parameter is of the String type, it's valid values as blow: C2C${userID} (for a one-to-one chat) GROUP{groupID} (for a group chat) @TIM#SYSTEM (for a system notification conversation) |
Promise
// delete the specified conversation and clear chat historylet promise = chat.deleteConversation('C2CExample');promise.then(function(imResponse) {// Deleted the conversation successfullyconst { conversationID } = imResponse.data;// ID of the deleted conversation}).catch(function(imError) {console.warn('deleteConversation error:', imError); // Failed to delete the conversation});
// delete the specified conversation and not clear chat historylet promise = chat.deleteConversation({conversationIDList: ['C2CExample'], clearHistoryMessage: false});promise.then(function(imResponse) {// Deleted the conversation successfullyconst { conversationIDList } = imResponse.data; // ID of the deleted conversation}).catch(function(imError) {console.warn('deleteConversation error:', imError); // Failed to delete the conversation});
// delete multiple conversations and clear chat historylet promise = chat.deleteConversation({conversationIDList: ['C2CExample', 'GROUPExample']});promise.then(function(imResponse) {const { conversationIDList } = imResponse.data; // ID list of the deleted conversations}).catch(function(imError) {console.warn('deleteConversation error:', imError); // Failed to delete the conversation});
// delete multiple conversations and clear chat historylet promise = chat.deleteConversation({conversationIDList: ['C2CExample', 'GROUPExample'],clearHistoryMessage: false});promise.then(function(imResponse) {const { conversationIDList } = imResponse.data; // ID list of the deleted conversations}).catch(function(imError) {console.warn('deleteConversation error:', imError); // Failed to delete the conversation});
Was this page helpful?