Muting and Unmuting Group Members

Last updated: 2020-03-11 17:53:08

PDF

Feature Description

  • The app admin can mute certain group members for a specific period of time.
  • The app admin can unmute certain group members.
  • After muted users exit from and then enter a group again, they remain muted.

API Invocation Description

Applicable group types

Group Type Support this RESTful API
Private No (see the following note)
Public Yes
ChatRoom Yes
AVChatRoom Yes
BChatRoom No (see the following note)

IM provides the preceding five built-in group types. For details on these types, see Group Systems.

  • Private group members cannot be muted.
  • In a BChatRoom group, only the app admin can send messages. Therefore, muting and unmuting are unnecessary in this case.

Request URL example

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

Request parameters

The following table describes only the parameters that are modified when this API is invoked. For details on other parameters, see RESTful API Overview.

Parameter Description
v4/group_open_http_svc/forbid_send_msg Request API
sdkappid SDKAppID assigned by the IM console when an app is created
identifier It must be an 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

  • Configuring muting
    Set ShutUpTime to a specific period of time to mute specified users.
    {
      "GroupId": "@TGS#2C5SZEAEF",
      "Members_Account": [ // Support a maximum of 500 accounts.
          "peter",
          "leckie"
      ],
      "ShutUpTime": 60 // Set the muting period in seconds.
    }
  • Canceling muting
    To cancel muting, set ShutUpTime to 0.
    {
      "GroupId": "@TGS#2C5SZEAEF",
      "Members_Account": [ // Support a maximum of 500 accounts.
          "peter",
          "leckie"
      ],
      "ShutUpTime": 0 // The 0 value indicates that muting is canceled.
    }

Request packet fields

Field Type Attribute Description
GroupId String Required The ID of the group to be queried.
Members_Account Array Required User accounts to be muted. Up to 500 accounts can be muted.
ShutUpTime Integer Required The muting period in seconds. The 0 value indicates that muting is canceled.

Response packet example

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

Response packet fields

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

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 parameter is invalid. In this case, check whether the request is correct based on the error description.
10007 The operation permissions are insufficient. For example, a common member in a public group tries to delete other users, but only the app admin can 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 RESTful online commissioning tool for APIs to commission this API.

References

Obtaining the list of muted group members (v4/group_open_http_svc/get_group_shutted_uin)