Skip to main content

Add Users to Chatroom Allowlist

The chatroom service provides the chatroom allowlist feature to protect important users in specific chatrooms, such as administrators, hosts, and other key roles in your app. Key capabilities include:

  • Protect users from being automatically kicked out of chatrooms: The chatroom service has an automatic kick-out mechanism for offline users (triggered when a new message is generated 30 seconds after the user goes offline, or when 30 messages are generated after the user goes offline). Users on the chatroom allowlist will not be automatically kicked out by the IM server.
  • Protect messages sent by users in chatrooms: The chatroom service has a message discard mechanism. To ensure the delivery of important messages, the service discards the latest messages that exceed the consumption limit based on the order of message sending, ensuring server stability. Messages sent by users on the chatroom allowlist are prioritized and protected under any circumstances.
  • Your app can add one or more users to the allowlist of a specific chatroom. A single chatroom supports up to 5 allowlist users.

Enable the Service​

Before using the chatroom allowlist feature, ensure that the service is enabled for the current App Key.

If the service is not enabled, the Server API will return a 1009 error. Note that if the API request frequency exceeds the limit due to continuous requests when the service is not enabled, the Server API will return an HTTP 429 Too Many Requests error (error code 1008).

Request Method​

POST: https://data center domain/chatroom/user/whitelist/add.json

Rate Limit: 100 requests per second

Signature Rule: All server API requests require rule verification. For details, see API Request Signature.

Body Parameters​

The HTTP request body is formatted as application/x-www-form-urlencoded and supports the following HTTP form parameters:

ParameterTypeRequiredDescription
chatroomIdStringYesThe chatroom ID.
userIdStringYesThe user ID in the chatroom. Multiple users can be submitted. A chatroom can have up to 5 allowlist users.

Response​

The HTTP response body contains a JSON object with the following structure:

Return ValueTypeDescription
codeNumberThe return code. 200 indicates success.

Request Example​

POST /chatroom/user/whitelist/add.json HTTP/1.1
Host: api.rong-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded

chatroomId=16&userId=123&userId=456

Response Example​

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{"code":200}