Skip to main content
POST
/
channel
/
whitelist_remove
curl -X POST "http://localhost:5001/channel/whitelist_remove" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "group123",
    "channel_type": 2,
    "uids": ["user1", "user2"]
  }'
{
  "status": "ok"
}

Overview

Remove specific users from channel whitelist. After removal, users will lose whitelist privileges and will not be able to send messages to the channel if whitelist mode is enabled.

Request Body

Required Parameters

channel_id
string
required
Channel ID, cannot be empty or contain special characters
channel_type
integer
required
Channel type
  • 1 - Person channel
  • 2 - Group channel
uids
array
required
List of user IDs to remove from whitelist
uids[]
string
User ID
curl -X POST "http://localhost:5001/channel/whitelist_remove" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "group123",
    "channel_type": 2,
    "uids": ["user1", "user2"]
  }'
{
  "status": "ok"
}

Response Fields

status
string
required
Operation status, returns "ok" on success

Status Codes

Status CodeDescription
200Users removed from whitelist successfully
400Request parameter error
403No management permission
404Channel does not exist
500Internal server error

Functionality

Remove Operation

The remove operation performs the following steps:
  1. Verify Users: Check if specified users are in the whitelist
  2. Remove Entries: Delete specified users from channel whitelist
  3. Permission Changes: Users lose whitelist privileges
  4. Take Effect Immediately: Permission changes take effect immediately

Permission Impact

Removed users will lose:
PrivilegeImpactEffective Time
Send PermissionCannot send messages in whitelist modeImmediately
Special PermissionsLose ability to bypass certain restrictionsImmediately
Priority ProcessingMessages no longer receive priority processingImmediately
Privilege IdentityLose whitelist user statusImmediately

Whitelist Mode Impact

When Whitelist Mode is Enabled

  • Removed Users: Cannot send messages to the channel
  • Other Whitelisted Users: Unaffected, continue to enjoy privileges
  • Regular Users: Still cannot send messages

When Whitelist Mode is Disabled

  • Removed Users: Can still send messages normally
  • Permission Changes: Mainly affects special permissions and priority

Use Cases

Permission Downgrade

# Remove users who no longer need privileges
curl -X POST "/channel/whitelist_remove" -d '{
  "channel_id": "group123",
  "channel_type": 2,
  "uids": ["former_admin"]
}'

Batch Cleanup

# Batch remove multiple users
curl -X POST "/channel/whitelist_remove" -d '{
  "channel_id": "group123",
  "channel_type": 2,
  "uids": ["user1", "user2", "user3"]
}'

Temporary Restriction

# Temporarily remove user privileges
curl -X POST "/channel/whitelist_remove" -d '{
  "channel_id": "group123",
  "channel_type": 2,
  "uids": ["temp_restricted_user"]
}'

Whitelist Management Strategy

Operation Comparison

OperationFunctionImpact ScopeUse Case
whitelist_addAdd to whitelistGrant privilegesGrant user privileges
whitelist_removeRemove from whitelistRemove privilegesRevoke user privileges
whitelist_setReplace entire whitelistComplete resetBatch management

Management Principles

  1. Principle of Least Privilege: Only give necessary users whitelist permissions
  2. Regular Review: Regularly check the necessity of whitelist users
  3. Permission Grading: Assign different levels of permissions based on user roles
  4. Transparent Management: Record all permission change operations

Best Practices

  1. Permission Audit: Regularly review whitelist user activity and necessity
  2. Progressive Removal: For important users, consider progressive permission downgrade
  3. Notification Mechanism: Notify relevant users and administrators before removal
  4. Backup Strategy: Backup current whitelist state before batch operations
  5. Monitor Impact: Monitor channel activity changes after removal
  6. Document Records: Record removal reasons and expected impact

Error Handling

Common Errors

Error MessageCauseSolution
Channel ID cannot be emptyNo channel ID providedEnsure valid channel ID is provided
Channel type cannot be 0Invalid channel typeUse valid channel type (1 or 2)
uids cannot be emptyNo user list providedProvide list of user IDs to remove
Remove whitelist failedRemove operation failedCheck if users are in whitelist