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

Overview

Delete a specified channel, including all related data and member relationships.

Request Body

Required Parameters

channel_id
string
required
Channel ID
channel_type
integer
required
Channel type
  • 1 - Personal channel
  • 2 - Group channel
curl -X POST "http://localhost:5001/channel/delete" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "group123",
    "channel_type": 2
  }'
{
  "status": "ok"
}

Response Fields

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

Status Codes

Status CodeDescription
200Channel deleted successfully
400Request parameter error
403No deletion permission
404Channel does not exist
500Internal server error

Deletion Impact

Data Cleanup

Deleting a channel will clean up the following related data:
Data TypeCleanup ScopeImpact
Channel InfoChannel basic info, settingsChannel completely disappears
Member RelationshipsAll member subscription relationshipsMembers can no longer receive messages
Message HistoryAll messages in the channelMessage records permanently deleted
Conversation RecordsChannel in user conversation listsChannel removed from conversation lists

User Impact

  • Member Notification: All members will receive channel dissolution notification
  • Conversation Cleanup: Channel removed from all members’ conversation lists
  • Message Loss: Message history in the channel will be unrecoverable
  • Permission Invalidation: All channel-related permissions immediately invalidated

Permission Requirements

Personal Channel (channel_type = 1)

  • Participants: Any participant in the channel can delete it
  • System Administrator: Has permission to delete any personal channel

Group Channel (channel_type = 2)

  • Group Owner: Only the group owner can dissolve the group
  • System Administrator: Has permission to delete any group
  • Regular Members: No deletion permission, can only leave the group

Security Considerations

Deletion Confirmation

Recommend secondary confirmation before deletion:
  1. Permission Verification: Confirm the operator has deletion permission
  2. Identity Verification: Require password or verification code input
  3. Impact Warning: Clearly inform the scope of deletion impact
  4. Final Confirmation: Provide a final chance to cancel

Data Backup

Consider data backup before deletion:
  • Message Export: Allow export of important messages
  • Member List: Save member information for rebuilding
  • File Backup: Backup important files in the channel
  • Operation Logging: Record detailed information about deletion operations

Alternative Solutions

Soft Delete

For important channels, consider soft deletion:
  • Hide Channel: Hide from user interface but retain data
  • Disable Features: Prohibit sending messages but retain history
  • Set Expiration: Set automatic deletion time
  • Permission Revocation: Remove all member permissions

Archive Processing

  • Message Archive: Transfer messages to archive storage
  • Read-only Mode: Set to read-only status
  • History Viewing: Allow viewing but no operations
  • Periodic Cleanup: Regularly clean up archived data

Best Practices

  1. Permission Control: Strictly control deletion permissions to prevent misoperations
  2. Operation Logging: Detailed logging of deletion operations including time, operator, reason
  3. Notification Mechanism: Timely notification to all related members
  4. Data Backup: Perform data backup before deleting important channels
  5. Recovery Mechanism: Provide recovery functionality within a certain time period
  6. Batch Deletion: Support batch deletion of multiple channels