logo
In-app Chat
Powered Byspreading
On this page

Recall a one-to-one message


Overview

You can call this operation to recall a one-to-one message sent within two minutes. To recall an earlier message, contact ZEGOCLOUD technical support. You can recall a message sent within 24 hours at maximum.

After a message is recalled, the recipient receives the notification in the following ZIM SDK callbacks.

iOSAndroidmacOSWindows
messageRevokeReceivedonMessageRevokeReceivedmessageRevokeReceivedonMessageRevokeReceived
WebFlutterUnity3DReact Native
messageRevokeReceivedonMessageRevokeReceivedOnMessageRevokeReceivedmessageRevokeReceived

Operation prototype

  • Request method: POST
  • Request URL: https://zim-api.zego.im/?Action=RevokePeerMessage
  • Protocol: HTTPS
  • QPS limit: 20 calls per second

Request parameters

The following table describes only the operation-specific request parameters and some common request parameters. For the complete list of common request parameters, see the Public request parameters section of the Accessing Server APIs topic.

ParameterTypeRequiredDescription
FromUserIdStringYesThe ID of the message sender.
ToUserIdStringYesThe ID of the message recipient.
MsgSeqNumberYesThe sequence of the message. Method for obtaining MsgSeq: - If a one-to-one message is sent from the client, obtain MsgSeq by using the Callback on message sent operation. - If a one-to-one message is sent by using the server API SendPeerMessage, obtain MsgSeq in the response data.
PayloadStringNoThe additional information of the recalling operation, which cannot exceed 200 bytes in length.
OfflinePushObjectNoThe offline push configuration. For more information, see OfflinePush Description.

Sample request

  • Request URL:

    Untitled
    https://zim-api.zego.im/?Action=RevokePeerMessage
    &<Common request parameters>
    
    1
    Copied!
  • Request body:

    Untitled
    {
        "FromUserId": "u1",
        "ToUserId": "u2",
        "MsgSeq": 10,
        "Payload": "payload",
        "OfflinePush" :{
            "Enable":1,
            "Title":"title",
            "Content":"content",
            "Payload":"payload"
        }
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberThe return code.
MessageStringThe description of the request result.
RequestIdStringThe request ID.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782"
}
1
Copied!

Return codes

The following table describes only the return codes related to the business logic of the operation. For the complete list of return codes, see Return codes.

Return CodeDescriptionSolution
660000002Invalid parameter.Check the input parameter. For more information, see Request parameters.
660000022The message is not found, which may be that the message has been deleted or does not exist.Check whether the message has been deleted and whether the value of the MsgSeq parameter is valid.
660000023The message has been recalled.Check whether the message has been recalled.
  • If so, no handling is required.
  • If not, contact ZEGOCLOUD technical support.
660000024The message has been sent too long.If you need to recall a message sent a long time ago, contact ZEGOCLOUD technical support.
660000026The message to be recalled and FromUserId do not match.Check whether the value of the FromUserId parameter is valid.
660300005The QPS limit specified in AppID is exceeded.Try again later, or check the QPS limit on related documentation.

Previous

Send room messages

Next

Recall a group message