Key Benefit: Enhance user experience with lightweight message previews that enable quick content assessment in channel lists, notifications, and conversation overviews without full message loading.

Feature Overview

Message Preview provides partial message data through channel and subchannel objects, offering users a brief summary of incoming messages. This feature enables efficient content assessment and prioritization without the overhead of loading complete message content.

Performance Optimization

Efficient data loading
  • Lightweight message preview
  • Reduced bandwidth usage
  • Faster interface rendering
  • Battery-efficient operations

Enhanced User Experience

Improved interaction flows
  • Quick message assessment
  • Priority-based responses
  • Streamlined notifications
  • Context-aware previews
Configuration Required: Message Preview must be enabled via API before use. The feature only works for new messages created after activation.Enable Message Preview API: PUT /api/v3/network-settings/chat
{
  "messagePreviewSetting": {
    "enabled": true,
    "isIncludeDeleted": false
  }
}

Implementation Guide

Access message previews through channel objectsRetrieve the latest message preview from channels to display in chat lists, notifications, and conversation overviews.

Message Preview Attributes

AttributeTypeDescription
messageIdStringUnique identifier of the message
channelIdStringID of the channel containing the message
userIdStringID of the user who created the message
typeMessageTypeMessage type (text, image, file, custom, etc.)
dataObjectMessage content data (text stored in “text” key)
isDeletedBooleanWhether the message has been deleted
createdAtDateMessage creation timestamp
updatedAtDateLast message update timestamp

Code Examples

// Get channel with message preview
token = channelRepository.getChannel("channel-id").observe { liveObject, error in
    guard let channel = liveObject.snapshot else { return }
    
    if let previewMessage = channel.messagePreview {
        // Access preview message data
        let messageText = previewMessage.data?["text"] as? String ?? ""
        let messageType = previewMessage.dataType
        let senderId = previewMessage.userId
        let timestamp = previewMessage.createdAt
        
        // Update UI with preview content
        updateChannelPreview(
            text: messageText,
            type: messageType,
            sender: senderId,
            time: timestamp
        )
    } else {
        // No preview available
        showEmptyChannelState()
    }
}
Availability: Message previews are only available for channels, and only for messages created after the feature is enabled in your network settings.
Implementation Strategy: Start with basic channel preview display, then enhance with notification integration and performance optimizations. Focus on data efficiency and user experience quality for the best results.