// Common BaseMessage Propertiesmessage.id; // int - Unique message IDmessage.sender; // User? - Message sendermessage.receiverUid; // String - Receiver UID or GUIDmessage.receiverType; // String - "user" or "group"message.category; // String - message/custom/action/interactive/call/agenticmessage.type; // String - text/image/video/audio/file/custommessage.sentAt; // DateTime? - When message was sentmessage.deliveredAt; // DateTime? - When message was deliveredmessage.readAt; // DateTime? - When message was readmessage.metadata; // Map<String, dynamic>? - Custom data// Type-specific PropertiestextMessage.text; // String - Text contentmediaMessage.attachment; // Attachment? - File detailscustomMessage.customData; // Map<String, dynamic>? - Custom payloadinteractiveMessage.interactiveData; // Map<String, dynamic> - Interactive element data
Every message in CometChat belongs to a category (message, custom, interactive, action, call) and has a specific type within that category. On the SDK side, all messages extend BaseMessage, with subclasses like TextMessage, MediaMessage, CustomMessage, InteractiveMessage, Action, and Call. Understanding this hierarchy helps you handle different message types correctly.
In the case of messages that belong to the custom category, there are no predefined types. Custom messages can be used by developers to send messages that do not fit in the default category and types provided by CometChat. For messages with the category custom, the developers can set their own type to uniquely identify the custom message. A very good example of a custom message would be the sharing of location co-ordinates. In this case, the developer can decide to use the custom message with type set to location.
An InteractiveMessage is a specialized object that encapsulates an interactive unit within a chat message, such as an embedded form that users can fill out directly within the chat interface. Messages belonging to the interactive category can further be classified into one of the below types:
form- for interactive form
card- for interactive card
scheduler- for scheduler message
customInteractive- for custom interaction messages
To know about Interactive messages please click here.
The action performed (e.g., joined, kicked, edited)
oldScope
String?
Previous member scope (for scope changes)
newScope
String?
New member scope (for scope changes)
actionBy
AppEntity?
Entity that performed the action
actionFor
AppEntity?
Entity the action was performed for
actionOn
AppEntity?
Entity the action was performed on
Inherits all BaseMessage properties.Action messages hold another property called action which actually determine the action that has been performed For the type groupMember the action can be either one of the below:
joined - when a group member joins a group
left - when a group member leaves a group
kicked - when a group member is kicked from the group
banned - when a group member is banned from the group
unbanned - when a group member is unbanned from the group
added - when a user is added to the group
scopeChanged - When the scope of a group member is changed.
For the type message, the action can be either one of the below:
Inherits all BaseMessage properties.The call messages have a property called status that helps you figure out the status of the call. The status can be either one of the below values: