Skip to main content
POST

Overview

Set (replace) the entire whitelist for a channel. This operation will first remove all existing whitelist entries and then add new ones. If UIDs is empty, the entire whitelist will be cleared.

Request Body

Required Parameters

string
required
Channel ID, cannot be empty or contain special characters
integer
required
Channel type
  • 1 - Person channel
  • 2 - Group channel

Optional Parameters

array
List of user IDs to set as whitelist. If empty, clears the entire whitelist.
string
User ID

Response Fields

string
required
Operation status, returns "ok" on success

Status Codes

Functionality

Set Operation

The set operation performs the following steps:
  1. Clear Existing Whitelist: Remove all existing whitelist entries for the channel
  2. Add New Entries: Add the provided user ID list to the whitelist
  3. Update Permissions: Take effect immediately, only whitelisted users can send messages (if whitelist mode is enabled)
  4. Conversation Management: Automatically create related conversations for person channels

Clear Operation

When uids is an empty array:
  • Clear all whitelist entries for the channel
  • Restore normal permissions for all users
  • Disable whitelist mode

Whitelist Mechanism

Permission Features

Whitelisted users enjoy the following privileges:

Whitelist Mode

  • When Enabled: Only whitelisted users can send messages
  • When Disabled: Whitelist does not affect message sending permissions
  • Person Channels: Whitelisted users automatically create conversations

Use Cases

Batch Management

Clear Whitelist

Reset Whitelist

Comparison with Other Whitelist Operations

Permission Hierarchy

Whitelist position in the permission system:

Conflict Handling

Best Practices

  1. Use Carefully: Set operation clears all existing whitelist, ensure this is intended behavior
  2. Backup Existing Data: Get current whitelist before setting as backup
  3. Permission Verification: Ensure operator has sufficient management permissions
  4. Progressive Management: For large channels, consider progressive whitelist management
  5. Monitor Effects: Monitor channel activity and user feedback after setting
  6. Document Records: Record whitelist change reasons and expected effects

Error Handling

Common Errors