tencent cloud

Feedback

Last updated: 2024-01-31 16:13:25

    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
    },
    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