tencent cloud

Feedback

React Native

Last updated: 2024-01-31 16:15:42

    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.

    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
    const msgListRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .findMessages(["msgid"]);
    // Edit the message
    if (msgListRes.code == 0) {
    const messageList = msgListRes.data;
    if (messageList.isNotEmpty) {
    const originMessage = messageList[0];
    originMessage.cloudCustomData = "change data";
    const modify = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .modifyMessage(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: (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