Skip to main content

Overview

A CometChatMessageTemplate provides the capability to define and customize both the structure and behavior of message bubbles. It acts as a blueprint for creating message bubble widgets, allowing you to manage appearance and interactions consistently.

Structure

The MessageBubble structure can be broken down into:
  1. Leading widget — Sender’s avatar
  2. Header widget — Sender’s name (useful in group chats)
  3. Content widget — Message content (text, images, videos, etc.)
  4. Bottom widget — Additional elements like link previews or “load more” buttons
  5. Footer widget — Timestamp and delivery/read status

Properties

PropertyDescription
typeMaps the template to a CometChat message type
categorySets the message category
headerViewCustom header widget for the bubble
contentViewCustom content widget for the bubble
footerViewCustom footer widget (timestamp, receipts)
bottomViewCustom bottom widget (link previews, etc.)
bubbleViewComplete custom bubble widget
optionsList of actions on long press

Customization

Header Widget


Content Widget


Bottom Widget



Options List


New Templates

Create entirely new templates for custom message types:
In V6, CometChatUIKit.getDataSource() is replaced by MessageTemplateUtils for accessing data source methods. Use the appropriate service locator to get message options and templates.