AI Agent Component Spec
AI Agent Component Spec
| Field | Value |
|---|---|
| Package | cometchat_chat_uikit |
| Conversation events | ccConversationDeleted, ccUpdateConversation |
| User events | ccUserBlocked, ccUserUnblocked |
| Group events | ccGroupCreated, ccGroupDeleted, ccGroupLeft, ccGroupMemberScopeChanged, ccGroupMemberKicked, ccGroupMemberBanned, ccGroupMemberUnbanned, ccGroupMemberJoined, ccGroupMemberAdded, ccOwnershipChanged |
| Message events | ccMessageSent, ccMessageEdited, ccReplyToMessage, ccMessageDeleted, ccMessageRead, ccLiveReaction, ccMessageForwarded, plus SDK listener events |
| Call events | ccOutgoingCall, ccCallAccepted, ccCallRejected, ccCallEnded |
| UI events | ccActiveChatChanged, showPanel, hidePanel, openChat, ccComposeMessage, onAiFeatureTapped |
| Purpose | Decoupled communication between UI Kit components — subscribe to events to react to changes without direct component references |
Quick Reference for AI Agents & DevelopersAvailable 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
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:
ccUserBlocked: Triggered when the logged-in user blocks another user.ccUserUnblocked: Triggered when the logged-in user unblocks another user.
- Dart
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:
ccGroupCreated: Triggered when the logged-in user creates a group.ccGroupDeleted: Triggered when the logged-in user deletes a group.ccGroupLeft: Triggered when the logged-in user leaves a group.ccGroupMemberScopeChanged: Triggered when the logged-in user changes the scope of another group member.ccGroupMemberBanned: Triggered when the logged-in user bans a group member from the group.ccGroupMemberKicked: Triggered when the logged-in user kicks another group member from the group.ccGroupMemberUnbanned: Triggered when the logged-in user unbans a user banned from the group.ccGroupMemberJoined: Triggered when the logged-in user joins a group.ccGroupMemberAdded: Triggered when the logged-in user adds new members to the group.ccOwnershipChanged: Triggered when the logged-in user transfers the ownership of their group to some other member.
- Dart
Conversation Events
TheCometChatConversationEvents component emits events when the logged-in user performs actions related to conversations. This allows for the UI to be updated accordingly.
Available Events:
ccConversationDeleted: Triggered when the logged-in user deletes a conversation.ccUpdateConversation: Triggered when a conversation is updated (e.g., unread count changes).
- Dart
Message Events
CometChatMessageEvents emits events when various actions are performed on messages within the application. These events facilitate updating the UI accordingly.
Available Events:
ccMessageSent: Triggered whenever a logged-in user sends any message. It can have two states:inProgressandsent.ccMessageEdited: Triggered whenever a logged-in user edits any message from the list of messages. It can have two states:inProgressandsent.ccMessageDeleted: Triggered whenever a logged-in user deletes any message from the list of messages.ccMessageRead: Triggered whenever a logged-in user reads any message.ccLiveReaction: Triggered whenever a logged-in user clicks on a live reaction.ccMessageForwarded: Triggered whenever a logged-in user forwards any message to a list of users or groups. It can have a state ofstatus.onTextMessageReceived: Triggered when a text message is received.onMediaMessageReceived: Triggered when a media message is received.onCustomMessageReceived: Triggered when a custom message is received.onTypingStarted: Triggered when a typing indicator starts.onTypingEnded: Triggered when a typing indicator ends.onMessagesDelivered: Triggered when messages are delivered.onMessagesRead: Triggered when messages are read.onMessageEdited: Triggered when a message is edited.onMessageDeleted: Triggered when a message is deleted.onTransientMessageReceived: Triggered when a transient message is received.onFormMessageReceived: Triggered when a form message is received.onCardMessageReceived: Triggered when a card message is received.onCustomInteractiveMessageReceived: Triggered when a custom interactive message is received.onInteractionGoalCompleted: Triggered when an interaction goal is completed.onSchedulerMessageReceived: Triggered when a scheduler message is received.onMessageReactionAdded: Triggered when a reaction is added to a message.onMessageReactionRemoved: Triggered when a reaction is removed from a message.ccReplyToMessage: Triggered when the logged-in user replies to a message.onMessagesDeliveredToAll: Triggered when messages are delivered to all recipients.onMessagesReadByAll: Triggered when messages are read by all recipients.onMessageModerated: Triggered when a message is moderated.onAIAssistantMessageReceived: Triggered when an AI Assistant message is received.onAIToolResultReceived: Triggered when an AI tool result is received.onAIToolArgumentsReceived: Triggered when AI tool arguments are received.
- Dart
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:
ccOutgoingCall: Triggered when the logged-in user initiates an outgoing call.ccCallAccepted: Triggered when a call is accepted.ccCallRejected: Triggered when a call is rejected.ccCallEnded: Triggered when a call is ended.
- Dart
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:
showPanel: Triggered to show an additional UI panel with custom elements.hidePanel: Triggered to hide a previously shown UI panel.ccActiveChatChanged: Triggered when the active chat changes, providing information about the current message, user, and group.openChat: Triggered to open a chat with a specific user or group.ccComposeMessage: Triggered when composing a message with a specific text and status.onAiFeatureTapped: Triggered when an AI feature is tapped for a specific user or group.
- Dart
Best Practices
Always Remove Listeners
Always Remove Listeners
Always remove event listeners in the
dispose() method to prevent memory leaks:- Dart
Use Unique Listener IDs
Use Unique Listener IDs
Use unique listener IDs for each widget to avoid conflicts:
- Dart
Handle Events Efficiently
Handle Events Efficiently
Keep event handlers lightweight and avoid heavy operations:
- Dart
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