Message Structure and Hierarchy
Every message in CometChat belongs to one of the following categories:| Category | Description |
|---|---|
message | Standard messages: text, image, video, audio, file |
custom | Developer-defined messages for sending custom data that doesn’t fit the default types |
card | Structured, interactive card messages (receive-only) rendered as a card bubble |
action | System-generated messages for group member actions or message actions |
call | Call-related messages: audio or video |
Message
A message belonging to the categorymessage can be one of the following types:
- text — A plain text message
- image — An image message
- video — A video message
- audio — An audio message
- file — A file message
Custom
For messages that belong to thecustom category, there are no predefined types. Custom messages can be used to send data that does not fit the default categories and types. Developers can set their own type to uniquely identify the custom message. For example, sharing location coordinates could use a custom message with type set to location.
Card
A message belonging to thecard category is a CardMessage — a structured, interactive message rendered as a card bubble. The card category has no predefined types; the layout is described by a block of card schema JSON that the CometChat Cards library renders.
Card Messages are receive-only: they are created via the Platform REST API or the Dashboard Bubble Builder and delivered to clients like any other message. See Send a Message → Card Message for the CardMessage fields and Receive Messages → Receiving Card Messages for handling incoming card messages.
Action
Action messages are system-generated. Messages belonging to theaction category can be of type:
- groupMember — action performed on a group member
- message — action performed on a message
action which determines the action that has been performed.
For the type groupMember, the action can be:
- 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
message, the action can be:
- edited — when a message is edited
- deleted — when a message is deleted
Call
Call messages can be of typeaudio or video. They include a status property which indicates the state of the call:
- initiated — when a call is initiated to a user/group
- ongoing — when the receiver has accepted the call
- canceled — when the call has been canceled by the initiator
- rejected — when the call has been rejected by the receiver
- unanswered — when the call was not answered by the receiver
- busy — when the receiver was busy on another call
- ended — when the call was successfully completed and ended