tencent cloud

Feedback

Last updated: 2023-07-20 10:47:01

    Feature Description

    When messages in a conversation are cleared, all the messages in the conversation will be cleared both locally and from the cloud, but the conversation itself will not be deleted.
    Note
    1. When messages in a conversation are cleared, unreadCount will be set to 0, and the content of lastMessage will be cleared as well.
    2. This API cannot be used to clear messages in a topic.
    3. To delete a conversation when clearing messages in the conversation, use the deleteConversation API.

    Clearing Messages

    API
    chat.clearHistoryMessage(conversationID);
    Parameters
    Name
    Type
    Description
    conversationID
    String
    Conversation ID, in the format of:
    C2C${userID} (for one-to-one chats)
    GROUP{groupID} (for group chats)
    Return values
    Promise
    Sample
    // Clear one-to-one messages locally and from the cloud
    let promise = chat.clearHistoryMessage('C2CExample');
    promise.then(function(imResponse) {
    // Messages cleared successfully
    }).catch(function(imError){
    console.warn('clearHistoryMessage error:', imError); // Message clearing failure information
    });
    // Clear group messages locally and from the cloud
    let promise = chat.clearHistoryMessage('GROUPExample');
    promise.then(function(imResponse) {
    // Messages cleared successfully
    }).catch(function(imError){
    console.warn('clearHistoryMessage error:', imError); // Message clearing failure information
    });
    
    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