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:
CategoryDescription
messageStandard messages: text, image, video, audio, file
customDeveloper-defined messages for sending custom data that doesn’t fit the default types
actionSystem-generated messages for group member actions or message actions
callCall-related messages: audio or video
interactiveEmbedded interactive units: form, card, scheduler, or custom interactive

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.

Interactive

An InteractiveMessage 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:
  1. form — interactive form
  2. card — interactive card
  3. scheduler — scheduler message
  4. customInteractive — custom interaction messages
See Interactive Messages for more details.

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