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 |
action | System-generated messages for group member actions or message actions |
call | Call-related messages: audio or video |
interactive | Embedded interactive units: form, card, scheduler, or custom interactive |
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.
Interactive
AnInteractiveMessage encapsulates an interactive unit within a chat message, such as an embedded form that users can fill out directly within the chat interface. Types include:
- form — interactive form
- card — interactive card
- scheduler — scheduler message
- customInteractive — custom interaction 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