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, cannot be empty or contain special characters
Channel type
1 - Person channel
2 - Group channel
List of user IDs to remove from whitelist
curl -X POST "http://localhost:5001/channel/whitelist_remove" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"uids": ["user1", "user2"]
}'
Response Fields
Operation status, returns "ok" on success
Status Codes
| Status Code | Description |
|---|
| 200 | Users removed from whitelist successfully |
| 400 | Request parameter error |
| 403 | No management permission |
| 404 | Channel does not exist |
| 500 | Internal server error |
Functionality
Remove Operation
The remove operation performs the following steps:
- Verify Users: Check if specified users are in the whitelist
- Remove Entries: Delete specified users from channel whitelist
- Permission Changes: Users lose whitelist privileges
- Take Effect Immediately: Permission changes take effect immediately
Permission Impact
Removed users will lose:
| Privilege | Impact | Effective Time |
|---|
| Send Permission | Cannot send messages in whitelist mode | Immediately |
| Special Permissions | Lose ability to bypass certain restrictions | Immediately |
| Priority Processing | Messages no longer receive priority processing | Immediately |
| Privilege Identity | Lose whitelist user status | Immediately |
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
| Operation | Function | Impact Scope | Use Case |
|---|
whitelist_add | Add to whitelist | Grant privileges | Grant user privileges |
whitelist_remove | Remove from whitelist | Remove privileges | Revoke user privileges |
whitelist_set | Replace entire whitelist | Complete reset | Batch management |
Management Principles
- Principle of Least Privilege: Only give necessary users whitelist permissions
- Regular Review: Regularly check the necessity of whitelist users
- Permission Grading: Assign different levels of permissions based on user roles
- Transparent Management: Record all permission change operations
Best Practices
- Permission Audit: Regularly review whitelist user activity and necessity
- Progressive Removal: For important users, consider progressive permission downgrade
- Notification Mechanism: Notify relevant users and administrators before removal
- Backup Strategy: Backup current whitelist state before batch operations
- Monitor Impact: Monitor channel activity changes after removal
- Document Records: Record removal reasons and expected impact
Error Handling
Common Errors
| Error Message | Cause | Solution |
|---|
| Channel ID cannot be empty | No channel ID provided | Ensure valid channel ID is provided |
| Channel type cannot be 0 | Invalid channel type | Use valid channel type (1 or 2) |
| uids cannot be empty | No user list provided | Provide list of user IDs to remove |
| Remove whitelist failed | Remove operation failed | Check if users are in whitelist |