tencent cloud

Feedback

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

    Feature Description

    This feature is used to recall a one-to-one or group message. After the message is recalled successfully, the value of its isRevoked attribute will be true.
    Note
    1. The time limit for message recall is two minutes by default. You can log in to the Chat console to change this limit.
    2. Call the getMessageList API to pull a recalled message from roaming one-to-one or group messages. The receiver needs to properly display the recalled message based on the isRevoked attribute of the message object, for example, as "The other party recalled a message" in a one-to-one conversation or as "XXX recalled a message" in a group conversation.

    Recall A Message

    API
    chat.revokeMessage(message);
    Parameter
    Name
    Type
    Description
    message
    Message
    Message instance
    Returned value
    Promise
    Sample
    // Recall a message
    let promise = chat.revokeMessage(message);
    promise.then(function(imResponse) {
    // Message recalled successfully
    }).catch(function(imError) {
    // Failed to recall the message
    console.warn('revokeMessage error:', imError);
    });
    // Received a message recall notification
    chat.on(TencentCloudChat.EVENT.MESSAGE_REVOKED, function(event) {
    // event.name - TencentCloudChat.EVENT.MESSAGE_REVOKED
    // event.data - An array that stores Message objects - [Message]
    // The `isRevoked` attribute value of each Message object is `true`.
    });
    // Encountered the recalled message while getting the list of messages in the conversation
    let promise = chat.getMessageList({conversationID: 'C2Ctest', count: 15});
    promise.then(function(imResponse) {
    const messageList = imResponse.data.messageList; // Message list
    messageList.forEach(function(message) {
    if (message.isRevoked) {
    // Process the recalled message
    } else {
    // Process ordinary messages
    }
    });
    });
    
    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