Skip to main content
Messaging is one of the core features of CometChat. We’ve thoughtfully created methods to help you send, receive, and fetch message history. At the minimum, you must add code for sending messages and receiving messages. Once you’ve implemented that, you can proceed to more advanced features like typing indicators and delivery & read receipts.

Message Structure and Hierarchy

Every message in CometChat belongs to one of the following categories:
CometChat message categories and types hierarchy: message, custom, card, action, and call
CategoryDescription
messageStandard messages: text, image, video, audio, file
customDeveloper-defined messages for sending custom data that doesn’t fit the default types
cardStructured, interactive card messages (receive-only) rendered as a card bubble
actionSystem-generated messages for group member actions or message actions
callCall-related messages: audio or video

Message

A message belonging to the category message can be one of the following types:
  1. text — A plain text message
  2. image — An image message
  3. video — A video message
  4. audio — An audio message
  5. file — A file message

Custom

For messages that belong to the custom 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 the card 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 the action category can be of type:
  1. groupMember — action performed on a group member
  2. message — action performed on a message
Action messages hold a property called action which determines the action that has been performed. For the type groupMember, the action can be:
  1. joined — when a group member joins a group
  2. left — when a group member leaves a group
  3. kicked — when a group member is kicked from the group
  4. banned — when a group member is banned from the group
  5. unbanned — when a group member is unbanned from the group
  6. added — when a user is added to the group
  7. scopeChanged — when the scope of a group member is changed
For the type message, the action can be:
  1. edited — when a message is edited
  2. deleted — when a message is deleted

Call

Call messages can be of type audio or video. They include a status property which indicates the state of the call:
  1. initiated — when a call is initiated to a user/group
  2. ongoing — when the receiver has accepted the call
  3. canceled — when the call has been canceled by the initiator
  4. rejected — when the call has been rejected by the receiver
  5. unanswered — when the call was not answered by the receiver
  6. busy — when the receiver was busy on another call
  7. ended — when the call was successfully completed and ended