Skip to main content
Quick Reference for AI Agents & Developers
Available Event Types:
  • User Events → Block/Unblock users
  • Group Events → Create, delete, join, leave groups
  • Conversation Events → Delete conversations, update conversations
  • Message Events → Send, edit, delete, receive messages, reactions, AI messages
  • Call Events → Outgoing, accepted, rejected, ended calls
  • UI Events → Show/hide panels, active chat changes
Events allow for a decoupled, flexible architecture where different parts of the application can interact without having to directly reference each other. This makes it easier to create complex, interactive experiences, as well as to extend and customize the functionality provided by the CometChat UI Kit. Both Components and Composite Components have the ability to emit events. These events are dispatched in response to certain changes or user interactions within the component. By emitting events, these components allow other parts of the application to react to changes or interactions, thus enabling dynamic and interactive behavior within the application.

User Events

CometChatUserEvents emit events when the logged-in user executes actions on another user. This class provides methods to add and remove listeners for user events, as well as methods to handle specific user actions such as blocking and unblocking users. Available Events:
  1. ccUserBlocked: Triggered when the logged-in user blocks another user.
  2. ccUserUnblocked: Triggered when the logged-in user unblocks another user.

Group Events

CometChatGroupEvents Emits events when the logged-in user performs actions related to groups. This class provides methods to listen to various group-related events and handle them accordingly. Available Events:
  1. ccGroupCreated: Triggered when the logged-in user creates a group.
  2. ccGroupDeleted: Triggered when the logged-in user deletes a group.
  3. ccGroupLeft: Triggered when the logged-in user leaves a group.
  4. ccGroupMemberScopeChanged: Triggered when the logged-in user changes the scope of another group member.
  5. ccGroupMemberBanned: Triggered when the logged-in user bans a group member from the group.
  6. ccGroupMemberKicked: Triggered when the logged-in user kicks another group member from the group.
  7. ccGroupMemberUnbanned: Triggered when the logged-in user unbans a user banned from the group.
  8. ccGroupMemberJoined: Triggered when the logged-in user joins a group.
  9. ccGroupMemberAdded: Triggered when the logged-in user adds new members to the group.
  10. ccOwnershipChanged: Triggered when the logged-in user transfers the ownership of their group to some other member.

Conversation Events

The CometChatConversationEvents component emits events when the logged-in user performs actions related to conversations. This allows for the UI to be updated accordingly. Available Events:
  1. ccConversationDeleted: Triggered when the logged-in user deletes a conversation.
  2. ccUpdateConversation: Triggered when a conversation is updated (e.g., unread count changes).

Message Events

CometChatMessageEvents emits events when various actions are performed on messages within the application. These events facilitate updating the UI accordingly. Available Events:
  1. ccMessageSent: Triggered whenever a logged-in user sends any message. It can have two states: inProgress and sent.
  2. ccMessageEdited: Triggered whenever a logged-in user edits any message from the list of messages. It can have two states: inProgress and sent.
  3. ccMessageDeleted: Triggered whenever a logged-in user deletes any message from the list of messages.
  4. ccMessageRead: Triggered whenever a logged-in user reads any message.
  5. ccLiveReaction: Triggered whenever a logged-in user clicks on a live reaction.
  6. ccMessageForwarded: Triggered whenever a logged-in user forwards any message to a list of users or groups. It can have a state of status.
  7. onTextMessageReceived: Triggered when a text message is received.
  8. onMediaMessageReceived: Triggered when a media message is received.
  9. onCustomMessageReceived: Triggered when a custom message is received.
  10. onTypingStarted: Triggered when a typing indicator starts.
  11. onTypingEnded: Triggered when a typing indicator ends.
  12. onMessagesDelivered: Triggered when messages are delivered.
  13. onMessagesRead: Triggered when messages are read.
  14. onMessageEdited: Triggered when a message is edited.
  15. onMessageDeleted: Triggered when a message is deleted.
  16. onTransientMessageReceived: Triggered when a transient message is received.
  17. onFormMessageReceived: Triggered when a form message is received.
  18. onCardMessageReceived: Triggered when a card message is received.
  19. onCustomInteractiveMessageReceived: Triggered when a custom interactive message is received.
  20. onInteractionGoalCompleted: Triggered when an interaction goal is completed.
  21. onSchedulerMessageReceived: Triggered when a scheduler message is received.
  22. onMessageReactionAdded: Triggered when a reaction is added to a message.
  23. onMessageReactionRemoved: Triggered when a reaction is removed from a message.
  24. ccReplyToMessage: Triggered when the logged-in user replies to a message.
  25. onMessagesDeliveredToAll: Triggered when messages are delivered to all recipients.
  26. onMessagesReadByAll: Triggered when messages are read by all recipients.
  27. onMessageModerated: Triggered when a message is moderated.
  28. onAIAssistantMessageReceived: Triggered when an AI Assistant message is received.
  29. onAIToolResultReceived: Triggered when an AI tool result is received.
  30. onAIToolArgumentsReceived: Triggered when AI tool arguments are received.

Call Events

CometChatCallEvents emits events related to calls within the application. This class provides methods to listen to call-related events and handle them accordingly. Available Events:
  1. ccOutgoingCall: Triggered when the logged-in user initiates an outgoing call.
  2. ccCallAccepted: Triggered when a call is accepted.
  3. ccCallRejected: Triggered when a call is rejected.
  4. ccCallEnded: Triggered when a call is ended.

UI Events

CometChatUIEvents emits events related to UI components within the CometChat UI. This class provides methods to listen to UI-related events and handle them accordingly. Available Events:
  1. showPanel: Triggered to show an additional UI panel with custom elements.
  2. hidePanel: Triggered to hide a previously shown UI panel.
  3. ccActiveChatChanged: Triggered when the active chat changes, providing information about the current message, user, and group.
  4. openChat: Triggered to open a chat with a specific user or group.
  5. ccComposeMessage: Triggered when composing a message with a specific text and status.
  6. onAiFeatureTapped: Triggered when an AI feature is tapped for a specific user or group.

Best Practices

Always remove event listeners in the dispose() method to prevent memory leaks:
Use unique listener IDs for each widget to avoid conflicts:
Keep event handlers lightweight and avoid heavy operations:

Next Steps

Message List

Learn how to display and manage messages with events

Conversations

Handle conversation events and updates

Groups

Manage group events and member actions

Methods

Explore available methods for UI Kit operations