Documentation Index
Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
- Register a listener with a unique ID using
addXListener() - Handle events in the callback methods
- Remove the listener with
removeXListener()when it’s no longer needed
User Listener
Receive online/offline presence events for users.| Method | Information |
|---|---|
| onUserOnline(user: CometChat.User) | This method is triggered when a user comes online and is available to chat. The details of the user can be obtained from the user object received as the method parameter. |
| onUserOffline(user: CometChat.User) | This method is triggered when a user goes offline. The details of the user can be obtained from the User object received as the parameter. |
UserListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Group Listener
Receive events when group members join, leave, are kicked/banned, or have their scope changed.| Method | Information |
|---|---|
| onGroupMemberJoined(action: CometChat.Action, joinedUser: CometChat.User, joinedGroup: CometChat.Group) | This method is triggered when a user joins any group. All the members present in the group will receive this event. |
| onGroupMemberLeft(action: CometChat.Action, leftUser: CometChat.User, leftGroup: CometChat.Group) | This method is triggered when a user who was a member of any group leaves the group. All the members of the group receive this event. |
| onGroupMemberKicked(action: CometChat.Action, kickedUser: CometChat.User, kickedBy: CometChat.User, kickedFrom: CometChat.Group) | This method is triggered when a user is kicked from a group. All the members including the user receive this event |
| onGroupMemberBanned(action: CometChat.Action, bannedUser: CometChat.User, bannedBy: CometChat.User, bannedFrom: CometChat.Group) | This method is triggered when a user is banned from a group. All the members including the user receive this event |
| onGroupMemberUnbanned(action: CometChat.Action, unbannedUser: CometChat.User, unbannedBy: CometChat.User, unbannedFrom: CometChat.Group) | This method is triggered when a user is unbanned from a group. All the members of the group receive this event. |
| onGroupMemberScopeChanged(action: CometChat.Action, changedUser: CometChat.User, newScope: string, oldScope: string, changedGroup: CometChat.Group) | This method is triggered when the scope of any Group Member has been changed. All the members that are a part of that group receive this event |
| onMemberAddedToGroup(action: CometChat.Action, userAdded: CometChat.User, addedBy: CometChat.User, addedTo: CometChat.Group) | This method is triggered when a user is added to any group. All the members including the user himself receive this event. |
GroupListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Message Listener
Receive events for incoming messages, typing indicators, read/delivery receipts, message edits/deletes, reactions, and interactive messages.| Method | Information |
|---|---|
| onTextMessageReceived(message: CometChat.TextMessage) | This event is triggered when a Text Message is received. |
| onMediaMessageReceived(message: CometChat.MediaMessage) | This event is triggered when a Media Message is received. |
| onCustomMessageReceived(message: CometChat.CustomMessage) | This event is triggered when a Custom Message is received. |
| onTypingStarted(typingIndicator: CometChat.TypingIndicator) | This event is triggered when a user starts typing in a user/group conversation |
| onTypingEnded(typingIndicator: CometChat.TypingIndicator) | This event is triggered when a user stops typing in a user/group conversation. |
| onMessagesDelivered(messageReceipt: CometChat.MessageReceipt) | This event is triggered when a set of messages are marked as delivered for any particular conversation. |
| onMessagesRead(messageReceipt: CometChat.MessageReceipt) | This event is triggered when a set of messages are marked as read for any particular conversation. |
| onMessageEdited(message: CometChat.BaseMessage) | This method is triggered when a particular message has been edited in a user/group conversation. |
| onMessageDeleted(message: CometChat.BaseMessage) | This event is triggered when a particular message is deleted in a user/group conversation. |
| onInteractiveMessageReceived(message: CometChat.InteractiveMessage) | This event is triggered when an Interactive Message is received. |
| onInteractionGoalCompleted(receipt: CometChat.InteractionReceipt) | This event is triggered when an interaction Goal is achieved. |
| onTransientMessageReceived(receipt: CometChat.TransientMessage) | This event is triggered when a Transient Message is received. |
| onMessageReactionAdded(receipt: CometChat.ReactionEvent) | This event is triggered when a reaction is added to a message in a user/group conversation. |
| onMessageReactionRemoved(receipt: CometChat.ReactionEvent) | This event is triggered when a reaction is removed from a message in a user/group conversation. |
MessageListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Call Listener
Receive events for incoming and outgoing call state changes.| Method | Information |
|---|---|
| onIncomingCallReceived(call: CometChat.Call) | This event is triggered when the logged-in user receives an incoming call. The details of the call can be obtained from the Call object received as the method parameter. |
| onOutgoingCallAccepted(call: CometChat.Call) | This event is triggered when the call initiated by the logged-in user is accepted by the recipient. The details of the call can be obtained from the Call object received as the method parameter. |
| onOutgoingCallRejected(call: CometChat.Call) | This event is triggered when the call initiated by the logged-in user is rejected by the recipient. The details of the call can be obtained from the Call object received as the method parameter |
| onIncomingCallCancelled(call: CometChat.Call) | This event is triggered when an incoming call is canceled by the initiator of the call. The details of the call can be obtained from the Call object received as the method parameter |
CallListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Next Steps
User Presence
Track when users come online or go offline
Receive Messages
Handle incoming messages in real time
Typing Indicators
Show when users are typing
Connection Status
Monitor SDK connection state changes