tencent cloud

Feedback

Last updated: 2023-10-11 09:40:11

    Feature Description

    If a user doesn't want to view the historical one-to-one or group messages after deleting a friend or leaving a group, the user can choose to delete the conversation.

    Deleting a Conversation

    Note
    1. Multi-client sync is disabled for conversation deletion by default. To enable it, log in to the Chat console, select Application Configuration > Feature Configuration > Login and Message > Multi-client Synchronization Settings, and enable Sync Conversation Deletion Across Clients.
    2. It supports for bulk deletion of conversations (up to 100 conversations at a time), with the option to choose whether to clear the history messages.
    API
    chat.deleteConversation(options);
    Parameter
    Name
    Type
    Description
    options
    String | Object
    1. 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)
    2. If the options parameter is of the Object type, it contains the following attribute values:
    conversationIDList: the list of conversations you want to delete
    clearHistoryMessage: true, by default, clear the chat history; false, not clear the chat history
    Returned value
    Promise
    Sample
    // delete the specified conversation and clear chat history
    let promise = chat.deleteConversation('C2CExample');
    promise.then(function(imResponse) {
    // Deleted the conversation successfully
    const { 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 history
    let promise = chat.deleteConversation({conversationIDList: ['C2CExample'], clearHistoryMessage: false});
    promise.then(function(imResponse) {
    // Deleted the conversation successfully
    const { 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 history
    let 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 history
    let 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
    });
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support