Manage chat room mute list
This page shows how to perform chat room member mute management by calling the Chat RESTful APIs, including muting and unmuting members in a chat room, and retrieving the list of muted members.
Before calling the following methods, ensure that you understand the call frequency limit of the Chat RESTful APIs described in Limitations.
Common parameters
The following table lists common request and response parameters of the Chat RESTful APIs:
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
host | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see Get the information of your project. | Yes |
org_name | String | The unique identifier assigned to each company (organization) by the Chat service. For how to get the org name, see Get the information of your project. | Yes |
app_name | String | The unique identifier assigned to each app by the Chat service. For how to get the app name, see Get the information of your project. | Yes |
username | String | The unique login account of the user. The user ID must be 64 characters or less and cannot be empty. The following character sets are supported:
| Yes |
chatroom_id | String | The chat room ID. The unique chat room identifier assigned to each chat room by the Chat. You can get the chat room ID from the response body in Retrieve the basic information of all chat rooms. | Yes |
Response parameters
Parameter | Type | Description |
---|---|---|
action | String | The request method. |
organization | String | The unique identifier assigned to each company (organization) by the Chat service. This is the same as org_name . |
application | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
applicationName | String | The unique identifier assigned to each app by the Chat service . This is the same as app_name . |
uri | String | The request URI. |
entities | JSON | The response entity. |
data | JSON | The details of the response. |
timestamp | Number | The Unix timestamp (ms) when the user is registered. |
duration | Number | The time duration (ms) from sending the HTTP request to receiving the response. |
Muting a chat room member
Mutes a chat room member. Once a chat room member is muted, this member cannot send messages in the chat room.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters .
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Content-Type | String | application/json | Yes |
Accept | String | application/json | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
Request body
The request body is a JSON object, which contains the following fields:
Field | Type | Description | Required |
---|---|---|---|
mute_duration | long | The duration (milliseconds) of how long the member is muted, starting from the current time.-1 indicates that the member is muted permanently. | Yes |
usernames | String | The array of usernames of chat room members that are to be muted. | Yes |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds, and the response body contains the following fields:
Field | Type | Description |
---|---|---|
result | Bool | The mute result:true: Successfalse : Failure |
expire | Number | The Unix timestamp (ms) when the mute state expires. |
user | String | The username of the muted chat room member. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Unmuting chat room members
Unmutes one or more chat room members. The unmuted members can continue to send messages in the chat room.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
Parameter | Type | Description | Required |
---|---|---|---|
member | String | The username of the chat room member to be unmuted. If you want to unmute multiple members, separate the member usernames with commas (","). In the URL, use "%2C" to represent ",". | Yes |
For other parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Accept | String | application/json | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. The response body contains the following fields:
Field | Type | Description |
---|---|---|
result | Bool | The unmute result: true : Success; false : Failure. |
user | String | The username of the unmuted chat room member. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Retrieving muted chat room members
Retrieves the list of all the muted members in the specified chat room.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters .
Request header
Parameter | Type | Description | Required |
---|---|---|---|
Accept | String | application/json | Yes |
Authorization | String | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. | Yes |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. The response body contains the following fields:
Field | Type | Description |
---|---|---|
expire | Number | The Unix timestamp (ms) when the mute expires. |
user | String | The username of the muted chat room member. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Muting all chat room members
Mutes all chat room members. Once this method call succeeds, only the members on the chat room allow list can send messages. For details, see Manage Chat Room Allow List.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Required | Description |
---|---|---|---|
Content-Type | String | Yes | application/json |
Authorization | String | Yes | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. The response body contains the following fields:
Parameter | Type | Description |
---|---|---|
result | Bool | Whether all members are successfully muted:true : Yes.false : No. |
expire | Long | The Unix timestamp when the global mute state expires. Unit: milliseconds. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Unmuting all chat room members
Unmutes all chat room members. Once unmuted, the chat room members resume the right to send messages in the chat room.
For each App Key, the call frequency limit of this method is 100 per second.
HTTP request
Path parameter
For the parameters and detailed descriptions, see Common parameters.
Request header
Parameter | Type | Required | Description |
---|---|---|---|
Content-Type | String | Yes | application/json |
Authorization | String | Yes | The authentication token of the user or administrator, in the format of Bearer ${token} , where Bearer is a fixed character, followed by an English space, and then the obtained token value. |
HTTP response
Response body
If the returned HTTP status code is 200
, the request succeeds. The response body contains the following fields:
Parameter | Type | Description |
---|---|---|
result | Boolean | Whether all chat room members are successfully unmuted:true : Yes.false : No. |
For other fields and detailed descriptions, see Common parameters.
If the returned HTTP status code is not 200
, the request fails. You can refer to Status codes for possible reasons.
Example
Request example
Response example
Status codes
For details, see HTTP Status Codes.