Deleting Messages Sent by the Specified User

Last updated: 2020-03-11 15:56:25

PDF

Feature Description

This API is used to delete messages sent by a specified user from the last 1,000 messages.

API Invocation Description

Applicable group types

Group Type Support This RESTful API
Private Yes
Public Yes
ChatRoom Yes
AVChatRoom No (see description below)
BChatRoom No (see description below)

IM supports the preceding five types of groups. For details, see Group Systems.

AVChatRoom and BChatRoom groups do not store roaming messages (here, the deleted messages refer to roaming messages.) For both types of groups, the deletion of user messages is ineffective (although no error will be returned). In a BChatRoom group, only the app admin can send messages, whereas ordinary users cannot.

Request URL example

https://console.tim.qq.com/v4/group_open_http_svc/delete_group_msg_by_sender?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

Request parameters

The following table lists and describes only the parameters to be modified when this API is invoked. For details on other parameters, see RESTful API Overview.

Parameter Description
v4/group_open_http_svc/delete_group_msg_by_sender The request API.
sdkappid The SDKAppID assigned by the IM console when an app is created.
identifier This must be the app admin account. For details, see App Admins.
usersig The signature generated by the app admin account. For details, see Generating UserSig.
random Enter a random 32-bit unsigned integer ranging from 0 to 4294967295.

Maximum invocation frequency

The maximum invocation frequency is 200 times per second.

Request packet example

Deletes group messages. Specifically, deletes messages sent by a user from the last 1,000 messages.

{
    "GroupId": "@TGS#2C5SZEAEF",    //Required
    "Sender_Account": "leckie"      //Required
}

Request packet fields

Field Type Attribute Description
GroupId String Required ID of the group for which messages are to be deleted
Sender_Account String Required ID of the sender whose messages are to be deleted

Response packet example

{
    "ActionStatus": "OK",
    "ErrorInfo": "",
    "ErrorCode": 0
}

Response packet fields

Field Type Description
ActionStatus String The request processing result. OK: succeeded. FAIL: failed.
ErrorInfo String Error information.
ErrorCode Integer The error code. 0: succeeded. Others: failed.

Error Codes

Unless a network error (such as error 502) occurs, the HTTP return code for this API is always 200. ErrorCode and ErrorInfo in the response packet represent the actual error code and error information, respectively.
For common error codes (60000 to 79999), see Error Codes.
The following table describes the error codes specific to this API.

Error Code Description
10002 An internal server error occurred. In this case, try again.
10003 A request command keyword is invalid.
10004 A request parameter is invalid. In this case, check whether request parameters are correct based on the error description.
10007 Operation permissions are insufficient. For example, an ordinary member in a public group attempts to remove a member from the group, but only the app admin has the permission to do so.
10010 The group does not exist or has been dismissed.
10015 The group ID is invalid. In this case, check whether the group ID is correct.

API Commissioning Tool

Use the online commissioning tool for RESTful APIs to commission this API.

References

Deleting a group member (v4/group_open_http_svc/delete_group_member)