Skip to main content
Content Control: Users can only edit and delete their own messages, ensuring content ownership while maintaining conversation integrity. All modifications include audit trails with timestamps for transparency.

Message Management Overview

Edit and delete functionality provides users with control over their sent messages, allowing corrections, content updates, and removal when necessary. All operations maintain audit trails and respect permission boundaries.

Message Editing

Content modification
  • Text message updates
  • Custom message editing
  • Timestamp tracking

Message Deletion

Content removal
  • Soft delete functionality
  • Conversation continuity
  • Permission enforcement
  • Visibility control

Implementation Guide

  • Edit Messages
  • Delete Messages
Modify existing message content with proper trackingEdit your own messages with automatic timestamp updates and audit timestamp for transparency.

Edit Permissions

PermissionDescription
Own Messages OnlyUsers can only edit messages they created
Time WindowOptional time limits for editing (configurable)
Content TypesText and custom messages support editing
Audit TraileditedAt automatically updated on modifications

Required Parameters

ParameterTypeDescription
messageIdStringUnique identifier of the message to edit
contentString/ObjectNew content for the message (text or custom data)

Optional Parameters

ParameterTypeDescription
tagsArray<String>Updated message tags
metadataObjectAdditional properties and information

Code Examples

// Edit text message
do {
    let updated = try await messageRepository.editTextMessage(withId: message.messageId, "<Text>")
} catch {
    // Handle error here
}

// Edit custom message
do {
    let updated = try await messageRepository.editCustomMessage(withId: message.messageId, [:])
} catch {
    // Handle error here
}

Edit Tracking

PropertyTypeDescription
editedAtDateTimeTimestamp of last edit
Edit Indicator: When a message is edited, the editedAt is automatically set to the current time, allowing your UI to display edit indicators to inform users when content has been modified.

Permission Management

Managing who can edit messages and whenOwnership-Based Permissions
  • Creator-Only Editing: Users can only edit messages they created
  • Role-Based Exceptions: Moderators and admins may have broader edit permissions
  • Channel-Level Controls: Channel moderators may also update individual message information
  • Group Permissions: Special permissions for group administrators
Optional: Time-Based Restrictions
  • Edit Windows: Configurable time limits after message creation
  • Grace Periods: Short windows for immediate corrections
  • Extended Permissions: Longer edit windows for premium users or specific roles
  • No Time Limits: Unrestricted editing for certain user types
Optional: Content-Based Restrictions
  • Message Type Limits: Some message types may not be editable
  • Reply Restrictions: Different rules for replies vs. top-level messages
  • Thread Considerations: Editing parent messages affects entire threads
  • Custom Message Rules: Special handling for custom message types
Controlling message deletion access and behaviorDelete Permission Levels
  • Self-Delete: Users can delete their own messages
  • Moderator Delete: Moderators can delete any message in their channels
  • Admin Delete: Administrators have global delete permissions
  • System Delete: Automated deletion based on policies
Deletion Types
  • Soft Delete: Message marked as deleted but preserved in database
  • Hard Delete: Permanent removal from all systems
Cascade Behavior
  • Thread Preservation: Maintain thread structure when parent messages deleted
  • Reply Handling: Options for orphaned replies when parent deleted
Audit and Recovery
  • Deletion Logs: Track all deletion events with timestamps
  • Recovery Options: Ability to potentially restore soft-deleted messages
  • Compliance Features: GDPR and data protection compliance
Implementation Strategy: Start with basic edit and delete functionality, then progressively add advanced features like edit history, undo options, and comprehensive validation. Always prioritize user experience and provide clear feedback for all operations.