Unsend a message

Update time: 2023/10/23 08:34:40

Unsends a message in chat rooms.

Overview

If app users unsend messages in a chat room, the message history stored in the cloud will also be deleted.

Upgrade the SDK to version 8.7.0 and later before you invoke this API to unsend messages in chat rooms.

Request URI

httpPOST https://api.netease.im/nimserver/chatroom/recall.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

Request parameters

  • For information about how to set the header in a POST request, see API Call methods.

  • The settings of the body in a POST request:

ParameterType RequiredDescription
roomid Long YesChat room ID
msgTimetag Long YesThe timestamp when a message was unsent in milliseconds.
msgId String Yesunsent message ID
fromAcc String YesUser account unsending the message, accid
operatorAcc String YesOperator account unsending the message, accid
notifyExt String Noextension field for notifications, up to 1,024 characters long.

Example

Example request (cURL)

curlcurl -X POST -H "CheckSum: 51eb13ea**85c7866c366" -H "AppKey: f54166405***6ad7799&fromAcc=acc01&" -H "Nonce: 1" -H "CurTime: 1451207708" -H "Content-Type: application/x-www-form-urlencoded" -d 'roomid=123&msgId=c9e6c306573778829419&msgTimetag=1212121&operatorAcc=acc01&fromAcc=acc02' 'https://api.netease.im/nimserver/chatroom/recall.action'

Example success response

json"Content-Type": "application/json; charset=utf-8"
{
  "code":200
}

Example error response

json"Content-Type": "application/json; charset=utf-8"
{
    "code":414
    "desc":"msgidclient is null"  // msgId field empty
}

Status codes

The following status codes are related to responses of this API. For the complete error codes, see Status codes.

Code Description Recommendation
200 Success -
414 Parameter error Check the format and restrictions of arguments based on the error message
416 Rate limit. Too many requests within a short period of time Lower the number of requests
500 Internal Server Error -
Was this page helpful?
Yes
No
  • Overview
  • Request URI
  • Request parameters
  • Example
  • Example request (cURL)
  • Example success response
  • Example error response
  • Status codes