• UIKit
  • SDK
  • RESTful API
Chat/
SDK/
JavaScript/
Message/
SDK
  • Overview
    • Product Features
    • Pricing
      • Billing Overview
      • Chat Monthly Package
      • Billing of Chat Out-of-Package Usage
  • Quick Start
  • Init and Login
    • Step 1: Install Chat SDK
    • Step 2: Initialize Chat SDK
    • Step 3: Login and Logout
  • Message
    • Overview
    • Send a Message
    • Receive a Message
    • Historical Message
    • Forward Messages
    • Modify a Message
    • Delete Messages
    • Clear History Message
    • Recall a Message
    • Send an Online Message
    • Message Read Receipt
    • Query Messages
    • Mentions
    • Targeted Group Message
    • Do not Notify
    • Key-Value Extensions
    • Reactions
    • Translation
    • Voice-to-Text
  • Conversation
    • Overview
    • Conversation List
    • Get Conversations
    • Unread Count
    • Pin Conversations
    • Delete Conversations
    • Draft
    • Mark
    • Conversation Group
  • Group
    • Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
    • Group Counter
  • Community and Topic
    • Manage Community
  • User
    • User Profile
    • User Status
    • Friend Management
    • Friend Group
    • Block List
    • Follow
  • Signaling
  • Client APIs
  • Changelog
  • Console Guide
    • New Console Introduction
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
    • Usage Statistics
    • Real-Time Monitor
    • Auxiliary Development Tools
  • Product Features
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Scenario-based Practice
    • Live Streaming Room Construction
    • How to Integrate Chat into Games
    • AI Chatbot
    • Super Large Entertainment and Collaboration Community
    • Discord Implementation Guide
  • Push Service
    • Overview
    • Activate the Service
    • Quick Start
    • Manufacturer Channel
      • Manufacturer Configuration
        • Android
        • iOS
        • Flutter
        • React-Native
      • Quick Integration
        • Android
        • iOS
        • Flutter
        • React-Native
    • Statistics
    • Troubleshooting Tool
    • Client APIs
      • Android
      • iOS
      • Flutter
      • React Native
    • REST API
      • Pushing to All/Tagged Users
      • UserID-Targeted Push
      • Obtaining Application Attribute Names
      • Setting Application Attribute Names
      • Obtaining User Attributes
      • Setting User Attributes
      • Deleting User Attributes
      • Obtaining User Tags
      • Adding User Tags
      • Deleting User Tags
      • Deleting All User Tags
      • Recalling Push
    • Push Callback
      • All Users / Tags / UserID Push Callback
      • Other Push Callbacks
    • Advanced Features
      • Custom Definition Badge
      • Custom Definition Ringtone
      • Customized Icon
      • Custom Definition Click Redirect
      • Push Message Categorization
    • Release Notes
      • Android
      • iOS
      • Flutter
      • React Native
    • FAQS
  • Error Codes

Recall a Message

Feature Overview

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.

UI Display








Recall a Message

API
chat.revokeMessage(message);
Parameters
Name
Type
Description
message
Message
Message instance
Return value
Promise
Examples
// 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
}
});
});