logo
In-app Chat
ZIMAudio
On this page

EditC2cMsgBody

POST

https://zim-api.zego.im/

The ZIM server supports developers to edit sent one-to-one or group chat messages.

After successfully editing a message, the message sent callback will be triggered. At the same time, the message receiving user can receive the message edited notification through the following ZIM SDK callback interfaces.

iOSAndroidmacOSWindows
messageEditedonMessageEditedmessageEditedonMessageEdited
WebMini ProgramFlutterReact Native
messageEditedmessageEditedonMessageEditedmessageEdited
uni-app | uni-app xHarmonyOS
messageEditedmessageEdited
Note

A single call can only modify one message in one conversation at a time.
By default, only messages sent within 24 hours are supported. If you need to edit earlier historical messages, please contact ZEGOCLOUD Technical Support for configuration.

QPS Limit
20 times/s

Request

Query Parameters

    Action stringrequired

    Possible values: [EditC2cMsgBody, EditGroupMsgBody]

    API prototype parameter

    https://zim-api.zego.im/?Action=EditC2cMsgBody or https://zim-api.zego.im/?Action=EditGroupMsgBody

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.

    Timestamp int64required

    💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    Signature stringrequired

    💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.

Body

required
    FromUserId stringrequired

    Possible values: <= 32 characters

    Message editing user ID.

    Note

    When editing group chat messages, this user needs to be a member of the target group.

    SenderId stringrequired

    Possible values: <= 32 characters

    Message sender ID.

    • Required when editing one-to-one messages.
    • Optional when editing group chat messages.
    ConvId stringrequired

    Possible values: <= 32 characters

    Conversation ID.

    • When editing one-to-one messages, fill in the userID of the other participating user.
    • When editing group chat messages, fill in the groupID of the target group.
    MsgType numberrequired

    Message type. Supports the following values:

    • 1: Text.
    • 10: Combined.
    • 200: Custom.
    ConvMsgSeq numberrequired

    Message Seq. How to obtain:

    • To edit a message sent by the client, obtain MsgSeq through the message sent callback.
    • To edit a one-to-one message sent by the server-side API SendPeerMessage, obtain MsgSeq through the API response data.
    • To edit a group chat message sent by the server-side API SendGroupMessage, obtain MsgSeq through the API response data.
    EditType numberrequired

    Edit type. Supports the following values:

    • 1: EM_MSG (edit message content), i.e., modify the Message field in MessageBody. In this case, Message cannot be empty.
    • 2: EM_PAYLOAD (edit message extended content), i.e., modify the ExtendedData field in MessageBody. In this case, ExtendedData can be empty.
    • 4: EM_AT (edit message mention attributes), i.e., modify AtListInfo or IsAtAll. In this case, both AtListInfo and IsAtAll can be empty.
    • 8: EM_AT_ALL (edit whether to mention all users), i.e., modify IsAtAll.
    • 16: EM_SUBMSGTYPE (edit custom message type), i.e., modify subMsgType. In this case, MsgType needs to be 200.

    You can perform bitwise operations on any of the above values to edit multiple attributes of a message at the same time. For example, 3: select both EM_MSG and EM_PAYLOAD to modify the Message and ExtendedData fields in MessageBody.

    MessageBody object

    Required when EditType includes EM_MSG or EM_PAYLOAD. For the structure of this parameter, please refer to the Message and ExtendedData field descriptions in text messages, combined messages, and custom messages in MessageBody description.

    AtListInfo object
    List of users to be mentioned. Required when EditType includes EM_AT.
    AtList string[]

    At list, user IDs, can be empty

    IsAtAll boolean

    Whether all users are mentioned. Required when EditType includes EM_AT_ALL.

    SubMsgType number

    Custom message type, defined by you, with a value range of [0, 200]. Required when EditType includes EM_SUBMSGTYPE.

Responses

OK
Schema
    Code number

    Return code.

    The following only lists the return codes related to the API business logic. For the complete return codes, please refer to Return codes.

    Return codeDescriptionSuggested Solution
    660000002Input parameter error.Please check the parameters.
    661000001Editable time has been exceeded.If you need to edit earlier historical messages, please contact ZEGOCLOUD Technical Support.
    661000005Edit failed.Please contact ZEGOCLOUD Technical Support.
    Message string

    Description of the operation result.

    RequestId string

    Request ID.

    StateMsgSeq number

    Message state Seq.

    EditMsgSeq number

    Message edit Seq.

    LatestEditTime number

    Unix timestamp of the most recent message edit, in seconds (s).

Previous

Push a message to all users

Next

Import a one-to-one message

On this page

Back to top