Skip to main content
POST

Overview

Set (replace) the entire blacklist for a channel. This operation will first remove all existing blacklist entries and then add new ones. If UIDs is empty, the entire blacklist 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 blacklist. If empty, clears the entire blacklist.
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 Blacklist: Remove all existing blacklist entries for the channel
  2. Add New Entries: Add the provided user ID list to the blacklist
  3. Delete Conversations: Automatically delete related conversations for blacklisted users
  4. Update Permissions: Take effect immediately, blacklisted users cannot send or receive messages

Clear Operation

When uids is an empty array:
  • Clear all blacklist entries for the channel
  • Restore normal permissions for all users
  • Does not affect existing conversations

Blacklist Mechanism

Permission Restrictions

Blacklisted users are subject to the following restrictions:

Special Cases

  • Live Channels: Do not process conversation deletion
  • Person Channels: Do not support blacklist operations
  • System Users: May have special permissions, not affected by blacklist

Use Cases

Batch Management

Clear Blacklist

Reset Blacklist

Comparison with Other Blacklist Operations

Best Practices

  1. Use Carefully: Set operation clears all existing blacklist, ensure this is intended behavior
  2. Backup Existing Data: Get current blacklist before setting as backup
  3. Permission Verification: Ensure operator has sufficient management permissions
  4. Log Recording: Record blacklist changes for auditing
  5. Notification Mechanism: Consider notifying relevant administrators of blacklist changes
  6. Test Validation: Thoroughly test before using in production environment

Error Handling

Common Errors