Group Member Management
This document guides developers on how to use RC's instant messaging iOS IMLib SDK to set or query group member profiles, add or remove group administrators, and other related functions.
This feature is supported starting from version 5.12.0.
Enabling the Service
Before using this feature, you must enable the profile hosting service by submitting a ticket.
Group Members
You can query group members of a specified group or set group member information.
Paginated Group Member Query
Use getGroupMembersByRole
to retrieve group member information paginated by member role.
The result
in the success callback returns the total number of members matching the query conditions.
Interface Prototype
- (void)getGroupMembersByRole:(NSString *)groupId
role:(RCGroupMemberRole)role
option:(RCPagingQueryOption *)option
success:(void (^)(RCPagingQueryResult<RCGroupMemberInfo *> *result))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameter Description
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group. |
role | RCGroupMemberRole | Group member role. |
option | RCPagingQueryOption | Query options including page token (optional, returns first page if empty), items per page (maximum 200), and sort order (descending by default). |
successBlock | Block | Success callback, returns query results as RCPagingQueryResult array. |
errorBlock | Block | Failure callback. |
Role Parameter Details
Type: RCGroupMemberRole
Enum Value | Description |
---|---|
RCGroupMemberRoleUndef | Undefined role (queries all member types) |
RCGroupMemberRoleNormal | Regular group member |
RCGroupMemberRoleManager | Administrator |
RCGroupMemberRoleOwner | Group Owner |
Option Parameter Details
Type: RCPagingQueryOption
Parameter | Type | Description |
---|---|---|
pageToken | NSString | Pagination token. For initial query, pass nil or @"". If the returned result (typeRCPagingQueryResult) contains a non-empty pageToken , use it for subsequent queries until pageToken returns @"", indicating completion. |
count | NSInteger | Items per page (maximum 100) |
order | BOOL | Default NO (descending by join time), YES for ascending |
Sample Code
- (void)getGroupMembersByRole:(NSString *)pageToken {
// Group ID
NSString *groupId = @"groupId";
// Member role to query (example shows query for all roles)
RCGroupMemberRole role = RCGroupMemberRoleUndef;
// Query options
RCPagingQueryOption *option = [[RCPagingQueryOption alloc] init];
// Pagination token (nil for first page)
option.pageToken = pageToken;
// Items per page
option.count = 20;
// Default NO (descending), YES for ascending
option.order = NO;
[[RCCoreClient sharedCoreClient] getGroupMembersByRole:groupId
role:role
option:option
success:^(RCPagingQueryResult<RCGroupMemberInfo *> * _Nonnull result) {
// Query successful
if (result.pageToken.length > 0) {
// Fetch next page
[self getGroupMembersByRole:result.pageToken];
} else {
// All data fetched
}
} error:^(RCErrorCode errorCode) {
// Query failed
}];
}
Get Group Member Information
Use getGroupMembers
to retrieve information for specified users in a group.
Maximum 100 members per query.
If the current user hasn't joined the specified group, member information cannot be retrieved.
Interface Prototype
- (void)getGroupMembers:(NSString *)groupId
userIds:(NSArray<NSString *> *)userIds
success:(void (^)(NSArray<RCGroupMemberInfo *> *groupMembers))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameter Description
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group. |
userIds | NSArray | List of user userIds. |
successBlock | Block | Success callback, returns query results as RCPagingQueryResult array. |
errorBlock | Block | Failure callback. |
Sample Code
// Group ID
NSString *groupId = @"groupId";
// Specified user IDs
NSArray *userIds = @[@"user1", @"user2"];
// Get member information
[[RCCoreClient sharedCoreClient] getGroupMembers:groupId
userIds:userIds
success:^(NSArray<RCGroupMemberInfo *> * _Nonnull groupMembers) {
// Query successful
} error:^(RCErrorCode errorCode) {
// Query failed
}];
Use searchGroupMembers
to paginate and search for group member information locally by nickname.
The search first matches the member's nickname
, then the username name
. Results are returned if either field matches.
The success callback's result
returns the total count of matching members.
Method signature
- (void)searchGroupMembers:(NSString *)groupId
name:(NSString *)name
option:(RCPagingQueryOption *)option
success:(void (^)(RCPagingQueryResult<RCGroupMemberInfo *> *result))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | The group's targetId |
name | NSString | Member nickname (required, max 64 chars) |
option | RCPagingQueryOption | Pagination options including page token (optional), page size (max 200), and sort order (default descending) |
successBlock | Block | Success callback returning RCPagingQueryResult array |
errorBlock | Block | Failure callback |
RCPagingQueryOption parameters
Type: RCPagingQueryOption
Parameter | Type | Description |
---|---|---|
pageToken | NSString | Pagination token. Pass nil or @"" for first page. Subsequent calls use the returned pageToken until empty. |
count | NSInteger | Page size (max 200) |
order | BOOL | Sort by join time (NO = descending, YES = ascending) |
Sample code
- (void)searchGroupMembers:(NSString *)pageToken {
// Group ID
NSString *groupId = @"groupId";
// Member nickname
NSString *name = @"";
// Query options
RCPagingQueryOption *option = [[RCPagingQueryOption alloc] init];
// Page token (nil for first page)
option.pageToken = pageToken;
// Page size
option.count = 20;
// Sort order (NO = descending)
option.order = NO;
// Search members by nickname
[[RCCoreClient sharedCoreClient] searchGroupMembers:groupId
name:name
option:option
success:^(RCPagingQueryResult<RCGroupMemberInfo *> * _Nonnull result) {
// Search succeeded
if (result.pageToken.length > 0) {
// Fetch next page
[self getGroupMembersByRole:result.pageToken];
} else {
// All data fetched
}
} error:^(RCErrorCode errorCode) {
// Search failed
}];
}
Set group member information
Use setGroupMemberInfo
to update member information in a specified group.
The memberInfoEditPermission determines whether member info can be modified. Unauthorized attempts return an error code.
Successful updates trigger the onGroupMemberInfoChanged
callback for all group members.
By default, modified information isn't audited. Enable content moderation in the Console under App Configuration > Security & Moderation > IM & RTC Moderation > IM Information Hosting Configuration.
Method signature
- (void)setGroupMemberInfo:(NSString *)groupId
userId:(NSString *)userId
nickname:(nullable NSString *)nickname
extra:(nullable NSString *)extra
successBlock:(void (^)(void))successBlock
errorBlock:(void (^)(RCErrorCode errorCode, NSArray<NSString *> * _Nullable errorKeys))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | Group ID |
userId | NSString | Member user ID |
nickname | NSString | Member nickname (max 64 chars, pass nil or @"" to clear) |
extra | NSString | Additional info (max 128 chars, pass nil or @"" to clear) |
successBlock | Block | Success callback |
errorBlock | Block | Failure callback (errorKeys returns failed audit fields when errorCode == RC_SERVICE_INFORMATION_AUDIT_FAILED) |
Sample code
// Group ID
NSString *groupId = @"groupId";
// Member user ID
NSString *userId = @"user1";
// Member nickname
NSString *nickname = @"nickname";
// Additional info (optional)
NSString *extra = @"Additional info";
[[RCCoreClient sharedCoreClient] setGroupMemberInfo:groupId
userId:userId
nickname:nickname
extra:extra
success:^{
// Update succeeded
} error:^(RCErrorCode errorCode, NSArray<NSString *> * _Nullable errorKeys) {
// Update failed
// errorKeys contains failed audit fields when errorCode == RC_SERVICE_INFORMATION_AUDIT_FAILED
}];
## Group Administrator
You can add or remove group administrators.
### Add Group Administrator
Use `addGroupManagers` to add group administrators.
Upon successful call, all group members will receive the `onGroupOperation` callback with operation type `RCGroupOperationAddManager`.
:::tip
- Only the group owner can add administrators.
- The target members must be group members, and the group owner cannot be set as administrator.
- The maximum number of administrators per group is **10**.
:::
#### Method Signature
```objc
- (void)addGroupManagers:(NSString *)groupId
userIds:(NSArray<NSString *> *)userIds
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group (required). |
userIds | NSArray | Array of user IDs (required). Must be existing group members. Maximum 10 users per operation. Group owner cannot be set as administrator. |
successBlock | Block | Success callback. |
errorBlock | Block | Failure callback. |
Example Code
// Group ID
NSString *groupId = @"groupId";
// User IDs to set as administrators
NSArray *userIds = @[@"user1", @"user2"];
// Add group administrators
[[RCCoreClient sharedCoreClient] addGroupManagers:groupId userIds:userIds success:^{
// Success
} error:^(RCErrorCode errorCode) {
// Failure
}];
Remove Group Administrator
Use removeGroupManagers
to remove group administrators.
Maximum 10 administrators can be removed per operation.
Upon successful call, all group members will receive the onGroupOperation
callback with operation type RCGroupOperationRemoveManager
.
- Only the group owner can remove administrators.
Method Signature
- (void)removeGroupManagers:(NSString *)groupId
userIds:(NSArray<NSString *> *)userIds
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group (required). |
userIds | NSArray | Array of user IDs (required). Maximum 10 administrators per operation. |
successBlock | Block | Success callback. |
errorBlock | Block | Failure callback. |
Example Code
// Group ID
NSString *groupId = @"groupId";
// User IDs to remove from administrators
NSArray *userIds = @[@"user1", @"user2"];
// Remove group administrators
[[RCCoreClient sharedCoreClient] removeGroupManagers:groupId userIds:userIds success:^{
// Success
} error:^(RCErrorCode errorCode) {
// Failure
}];
Members I Follow
You can add, remove, or query group members you follow.
Features
- Maximum 200 members can be followed per group.
- Messages from followed members will bypass conversation Do Not Disturb settings and trigger notifications normally.
- Push notification priority for messages from followed members:
- Application-level Do Not Disturb > Silent Message flag > Followed Member status > Conversation Do Not Disturb settings
- See Do Not Disturb Overview for details
- Changes to followed members will trigger the multi-device sync callback onGroupFollowsChangedSync on the user's other logged-in devices.
Add Members I Follow
Use addGroupFollows
to add members to your follow list.
Maximum 100 members per operation.
Method Signature
- (void)addGroupFollows:(NSString *)groupId
userIds:(NSArray<NSString *> *)userIds
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group. |
userIds | NSArray | Array of user IDs. Maximum 100 users per operation. |
successBlock | Block | Success callback. |
errorBlock | Block | Failure callback. |
Example Code
// Group ID
NSString *groupId = @"groupId";
// User IDs to follow
NSArray *userIds = @[@"user1", @"user2"];
// Add members to follow list
[[RCCoreClient sharedCoreClient] addGroupFollows:groupId userIds:userIds success:^{
} error:^(RCErrorCode errorCode) {
}];
Remove Members I Follow
Use removeGroupFollows
to remove members from your follow list.
Supports batch removal of up to 100 members per operation.
Method Signature
- (void)removeGroupFollows:(NSString *)groupId
userIds:(NSArray<NSString *> *)userIds
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group. |
userIds | NSArray | Array of user IDs. Maximum 100 users per operation. |
successBlock | Block | Success callback. |
errorBlock | Block | Failure callback. |
Example Code
// Group ID
NSString *groupId = @"groupId";
// User IDs to unfollow
NSArray *userIds = @[@"user1", @"user2"];
// Remove Members I Follow
[[RCCoreClient sharedCoreClient] removeGroupFollows:groupId userIds:userIds success:^{
// Success
} error:^(RCErrorCode errorCode) {
// Failure
}];
Get Members I Follow
Use getGroupFollows
to query Members I Follow.
Method Signature
- (void)getGroupFollows:(NSString *)groupId
success:(void (^)(NSArray<RCFollowInfo *> *followInfos))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock;
Parameters
Parameter | Type | Description |
---|---|---|
groupId | NSString | The targetId of the group. |
successBlock | Block | Success callback, returns an array of RCFollowInfo. |
errorBlock | Block | Failure callback. |
Example Code
// Group ID
NSString *groupId = @"groupId";
// Get Members I Follow
[[RCCoreClient sharedCoreClient] getGroupFollows:groupId
success:^(NSArray<RCFollowInfo *> * _Nonnull followInfos) {
// Success
} error:^(RCErrorCode errorCode) {
// Failure
}];