AI Integration Quick Reference
AI Integration Quick Reference
Group owners cannot leave without first transferring ownership to another member. See Transfer Group Ownership.
Leave a Group
UseleaveGroup() to leave a group.
Parameters
| Parameter | Type | Description |
|---|---|---|
guid | String | The GUID of the group you would like to leave |
onSuccess | Function(String returnResponse)? | Callback triggered on successful leave |
onError | Function(CometChatException excep)? | Callback triggered on error |
- Dart
Response
Response
On Success — A
String message confirming the operation:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
message | string | Success confirmation message | "cometchat-guid-1 left successfully" |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_NOT_A_MEMBER" |
message | string | Human-readable error message | "The user is not a member of this group." |
details | string | Additional technical details | "Cannot leave a group that you are not a member of." |
Real-time Group Member Left Events
In other words, as a member of a group, how do I know if someone has left it when my app is running? If a user leaves a group, the members of the group receive a real-time event in theonGroupMemberLeft() method of the GroupListener class.
- Dart
Missed Group Member Left Events
In other words, as a member of a group, how do I know if someone has left it when my app is not running? When you retrieve the list of previous messages if a member has left any group that the logged-in user is a member of, the list of messages will contain anAction message. An Action message is a sub-class of BaseMessage class.
For the group member left event, in the Action object received, the following fields can help you get the relevant information-
action-leftactionBy- User object containing the details of the user who left the groupactionFor- Group object containing the details of the group the user has left
Next Steps
Join a Group
Join public or password-protected groups
Delete a Group
Permanently delete a group (admin only)
Kick & Ban Members
Remove or ban members from a group
Retrieve Groups
Fetch and filter the list of groups