please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
Flutter/
Message/
SDK
  • Install Chat SDK
    • Install
  • Initialize Chat SDK
    • Initialize
  • Login And Logout
    • Login and Logout
  • Message
    • Message Overview
    • Sending Message
    • Receiving Message
    • Historical Message
    • Forwarding Message
    • Modifying Message
    • Message Inserting
    • Deleting Message
    • Clearing Messages
    • Recalling Message
    • Online Message
    • Read Receipt
    • Querying Message
    • Group @ Message
    • Targeted Group Message
    • Notification Muting
    • Message Extension
  • Conversation
    • Conversation Overview
    • Conversation List
    • Getting Conversation
    • Conversation Unread Count
    • Pinning Conversation to the Top
    • Deleting Conversation
    • Conversation Draft
    • Conversation Group
  • Group
    • Group Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
  • User
    • User Profile
    • Friend Management
    • Friend List
    • Blocklist
  • Offline Push
    • Offline Push
  • Signaling
    • Signaling Management
  • Local Search
    • Searching for Message
    • Searching for Friend
    • Searching Group
    • Searching for Group Member
  • API Reference
    • Client APIs
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • 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
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Modifying Message

Overview

This feature enables any member in a conversation to modify a successfully sent message in the conversation. The message will be synced to all the members in the conversation once modified successfully.
Note:
This feature is supported only by the SDK for Flutter on v4.0.0 or later.

Modifying a Message

A conversation participant can call the modifyMessage API (details) to modify a sent message in the conversation. The Chat SDK allows any conversation participant to modify a message in the conversation. You can add more restrictions at the business layer, for example, only allowing the message sender to modify the message.
Currently, the following information of a message can be modified:
localCustomData (details)
localCustomInt (details)
cloudCustomData (details)
V2TIMTextElem (details)
V2TIMCustomElem (details)
Sample code:
// Find the message to be modified
V2TimValueCallback<List<V2TimMessage>> msgListRes = await TencentImSDKPlugin.v2TIMManager.getMessageManager().findMessages(messageIDList: ['msgid']);
// Edit the message
if(msgListRes.code == 0){
List<V2TimMessage> messageList = msgListRes.data;
if(messageList.isNotEmpty){
V2TimMessage originMessage = messageList[0];
originMessage.cloudCustomData = "change data";
V2TimValueCallback<V2TimMessageChangeInfo> modify = await TencentImSDKPlugin.v2TIMManager.getMessageManager().modifyMessage(message: originMessage);
if(modify.code == 0){
if(modify.data.code ==0){
// Modified successfully
}
}
}
}

Listening for a Message Modification Callback

Conversation participants call addAdvancedMsgListener (details) to add the advanced message listener.
After a message in the conversation is modified, all the participants will receive the onRecvMessageModified callback (details), which contains the modified message object.
Sample code:
onRecvMessageModified: (V2TimMessage message) {
// `msg` is the modified message object
},