Skip to main content

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.

tip

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

ParameterTypeDescription
groupIdNSStringThe targetId of the group.
roleRCGroupMemberRoleGroup member role.
optionRCPagingQueryOptionQuery options including page token (optional, returns first page if empty), items per page (maximum 200), and sort order (descending by default).
successBlockBlockSuccess callback, returns query results as RCPagingQueryResult array.
errorBlockBlockFailure callback.

Role Parameter Details

Type: RCGroupMemberRole

Enum ValueDescription
RCGroupMemberRoleUndefUndefined role (queries all member types)
RCGroupMemberRoleNormalRegular group member
RCGroupMemberRoleManagerAdministrator
RCGroupMemberRoleOwnerGroup Owner

Option Parameter Details

Type: RCPagingQueryOption

ParameterTypeDescription
pageTokenNSStringPagination 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.
countNSIntegerItems per page (maximum 100)
orderBOOLDefault 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.

tip

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

ParameterTypeDescription
groupIdNSStringThe targetId of the group.
userIdsNSArrayList of user userIds.
successBlockBlockSuccess callback, returns query results as RCPagingQueryResult array.
errorBlockBlockFailure 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

ParameterTypeDescription
groupIdNSStringThe group's targetId
nameNSStringMember nickname (required, max 64 chars)
optionRCPagingQueryOptionPagination options including page token (optional), page size (max 200), and sort order (default descending)
successBlockBlockSuccess callback returning RCPagingQueryResult array
errorBlockBlockFailure callback

RCPagingQueryOption parameters

Type: RCPagingQueryOption

ParameterTypeDescription
pageTokenNSStringPagination token. Pass nil or @"" for first page. Subsequent calls use the returned pageToken until empty.
countNSIntegerPage size (max 200)
orderBOOLSort 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.

tip

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

ParameterTypeDescription
groupIdNSStringGroup ID
userIdNSStringMember user ID
nicknameNSStringMember nickname (max 64 chars, pass nil or @"" to clear)
extraNSStringAdditional info (max 128 chars, pass nil or @"" to clear)
successBlockBlockSuccess callback
errorBlockBlockFailure 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

ParameterTypeDescription
groupIdNSStringThe targetId of the group (required).
userIdsNSArrayArray of user IDs (required). Must be existing group members. Maximum 10 users per operation. Group owner cannot be set as administrator.
successBlockBlockSuccess callback.
errorBlockBlockFailure 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.

tip
  • 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

ParameterTypeDescription
groupIdNSStringThe targetId of the group (required).
userIdsNSArrayArray of user IDs (required). Maximum 10 administrators per operation.
successBlockBlockSuccess callback.
errorBlockBlockFailure 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

ParameterTypeDescription
groupIdNSStringThe targetId of the group.
userIdsNSArrayArray of user IDs. Maximum 100 users per operation.
successBlockBlockSuccess callback.
errorBlockBlockFailure 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

ParameterTypeDescription
groupIdNSStringThe targetId of the group.
userIdsNSArrayArray of user IDs. Maximum 100 users per operation.
successBlockBlockSuccess callback.
errorBlockBlockFailure 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

ParameterTypeDescription
groupIdNSStringThe targetId of the group.
successBlockBlockSuccess callback, returns an array of RCFollowInfo.
errorBlockBlockFailure 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
}];