The Admin or Moderator of the group can kick a member out of the group using the kickGroupMember() method.
Parameter
Type
Description
UID
String
The UID of the user to be kicked
GUID
String
The GUID of the group from which user is to be kicked
Swift
Objective C
Report incorrect code
Copy
Ask AI
let uid = "cometchat-uid-2"let guid = "cometchat-guid-1"CometChat.kickGroupMember(UID: uid, GUID: guid, onSuccess: { (response) in print("\(uid) is kicked from the group \(guid) successfully.")}, onError: { (error) in print("Error: \(error?.errorDescription)")})
Report incorrect code
Copy
Ask AI
NSString *UID = @"cometchat-uid-2";NSString *GUID = @"cometchat-guid-1";[CometChat kickGroupMemberWithUID:UID GUID:GUID onSuccess:^(NSString * response) { NSLog(@"%@ kicked from the group %@ successfully", UID, GUID);} onError:^(CometChatException * error) { NSLog(@"Error: %@", [error errorDescription]);}];
The kicked user will be no longer part of the group and can not perform any actions in the group, but the kicked user can rejoin the group.
Sample Payload - Kick Member
Request Parameters:
Parameter
Type
Description
UID
String
Unique identifier of the user to kick. Example: "cometchat-uid-2"
GUID
String
Unique identifier of the group. Example: "cometchat-guid-1"
Success Response:
Parameter
Type
Description
response
String
Success message. Example: "cometchat-uid-2 is kicked from the group successfully."
The Admin or Moderator of the group can ban a member from the group using the banGroupMember() method.
Parameter
Type
Description
UID
String
The UID of the user to be banned
GUID
String
The GUID of the group from which user is to be banned
Swift
Objective C
Report incorrect code
Copy
Ask AI
let uid = "cometchat-uid-2"let guid = "cometchat-guid-1"CometChat.banGroupMember(UID: uid, GUID: guid, onSuccess: { (response) in print("\(uid) is banned from the group \(guid) successfully.")}, onError: { (error) in print("Error: \(error?.errorDescription)")})
Report incorrect code
Copy
Ask AI
NSString *UID = @"cometchat-uid-2";NSString *GUID = @"cometchat-guid-1";[CometChat banGroupMemberWithUID:UID GUID:GUID onSuccess:^(NSString * response) { NSLog(@"%@ banned from the group %@ successfully", UID, GUID);} onError:^(CometChatException * error) { NSLog(@"Error: %@", [error errorDescription]);}];
The banned user will be no longer part of the group and can not perform any actions in the group. A banned user cannot rejoin the same group without being unbanned.
Sample Payload - Ban Member
Request Parameters:
Parameter
Type
Description
UID
String
Unique identifier of the user to ban. Example: "cometchat-uid-2"
GUID
String
Unique identifier of the group. Example: "cometchat-guid-1"
Success Response:
Parameter
Type
Description
response
String
Success message. Example: "cometchat-uid-2 is banned from the group successfully."
Only Admin or Moderators of the group can unban a previously banned member from the group using the unbanGroupMember() method.
Parameter
Type
Description
UID
String
The UID of the user to be unbanned
GUID
String
The GUID of the group from which user is to be unbanned
Swift
Objective C
Report incorrect code
Copy
Ask AI
let uid = "cometchat-uid-2"let guid = "cometchat-guid-1"CometChat.unbanGroupMember(UID: uid, GUID: guid, onSuccess: { (response) in print("\(uid) is unbanned from the group \(guid) successfully.")}, onError: { (error) in print("Error: \(error?.errorDescription)")})
Report incorrect code
Copy
Ask AI
NSString *UID = @"cometchat-uid-2";NSString *GUID = @"cometchat-guid-1";[CometChat unbanGroupMemberWithUID:UID GUID:GUID onSuccess:^(NSString * response) { NSLog(@"%@ unbanned from the group %@ successfully", UID, GUID);} onError:^(CometChatException * error) { NSLog(@"Error: %@", [error errorDescription]);}];
The unbanned user can now rejoin the group.
Sample Payload - Unban Member
Request Parameters:
Parameter
Type
Description
UID
String
Unique identifier of the user to unban. Example: "cometchat-uid-2"
GUID
String
Unique identifier of the group. Example: "cometchat-guid-1"
Success Response:
Parameter
Type
Description
response
String
Success message. Example: "cometchat-uid-2 is unbanned from the group successfully."
In other words, as a member of a group, how do I know when someone is banned/kicked when my app is not running?When you retrieve the list of previous messages if a member has been kicked/banned/unbanned from any group that the logged-in user is a member of, the list of messages will contain an Action message.