Managing group members
This guide covers how to query and update channel member profiles, and manage channel admins using the Nexconn SDK.
Members
Query channel members or update member profiles within a group.
Get members by role (paginated)
Use GroupChannel.createGroupMembersByRoleQuery() with GroupMembersByRoleQueryParams to retrieve channel members filtered by role, with pagination.
GroupMemberRole enum values:
| Enum Value | Role |
|---|---|
GroupMemberRole.UNDEF | Undefined (queries all roles) |
GroupMemberRole.NORMAL | Channel member |
GroupMemberRole.MANAGER | Channel admin |
GroupMemberRole.OWNER | Channel owner |
- Kotlin
- Java
val params = GroupMembersByRoleQueryParams(
groupId = "groupId"
).apply {
role = GroupMemberRole.UNDEF
pageSize = 20
}
val query = GroupChannel.createGroupMembersByRoleQuery(params)
query.loadNextPage { result, error ->
if (error == null && result != null) {
result.data?.forEach { member ->
println("Member: ${member.userId}, Nickname: ${member.nickname}")
}
if (query.hasMore) {
// Fetch next page
}
}
}
GroupMembersByRoleQueryParams params = new GroupMembersByRoleQueryParams("groupId");
params.setRole(GroupMemberRole.UNDEF);
params.setPageSize(20);
GroupMembersByRoleQuery query = GroupChannel.createGroupMembersByRoleQuery(params);
query.loadNextPage((result, error) -> {
if (error == null && result != null) {
for (GroupMemberInfo member : result.getData()) {
System.out.println("Member: " + member.getUserId());
}
if (query.getHasMore()) {
// Fetch next page
}
}
});
Get specific members
Use groupChannel.getMembers() to retrieve info for specific users in a group. Supports batch queries of up to 100 user IDs.
You must be a member of the group to query member info.
- Kotlin
- Java
val channel = GroupChannel("groupId")
val userIds = listOf("userId1", "userId2", "userId3")
channel.getMembers(userIds) { members, error ->
if (error == null && members != null) {
members.forEach { member ->
println("Member: ${member.userId}, Nickname: ${member.nickname}")
}
}
}
GroupChannel channel = new GroupChannel("groupId");
List<String> userIds = Arrays.asList("userId1", "userId2", "userId3");
channel.getMembers(userIds, (members, error) -> {
if (error == null && members != null) {
for (GroupMemberInfo member : members) {
System.out.println("Member: " + member.getUserId());
}
}
});
Search members by nickname
Use GroupChannel.createSearchGroupMembersQuery() with SearchGroupMembersQueryParams to search local channel members by name, with pagination.
The search matches the member nickname first, then falls back to name. A result is returned if either field matches.
- Kotlin
- Java
val params = SearchGroupMembersQueryParams(
groupId = "groupId",
memberName = "name"
).apply {
pageSize = 20
}
val query = GroupChannel.createSearchGroupMembersQuery(params)
query.loadNextPage { result, error ->
if (error == null && result != null) {
result.data?.forEach { member ->
println("Member: ${member.userId}, Nickname: ${member.nickname}")
}
if (query.hasMore) {
// Fetch next page
}
}
}
SearchGroupMembersQueryParams params = new SearchGroupMembersQueryParams(
"groupId",
"name"
);
params.setPageSize(20);
SearchGroupMembersQuery query = GroupChannel.createSearchGroupMembersQuery(params);
query.loadNextPage((result, error) -> {
if (error == null && result != null) {
for (GroupMemberInfo member : result.getData()) {
System.out.println("Member: " + member.getUserId());
}
if (query.getHasMore()) {
// Fetch next page
}
}
});
Update member profile
Use groupChannel.setMemberInfo() with SetGroupMemberInfoParams to update a member's nickname and extra info within a group.
On success, all channel members receive an onGroupMemberInfoChanged callback.
Edit permission is controlled by memberInfoEditPermission (GroupMemberInfoEditPermission):
| Enum Value | Description |
|---|---|
OWNER_OR_MANAGER_OR_SELF | Channel owner, admin, and the member themselves can edit |
OWNER_OR_SELF | Channel owner and the member themselves can edit |
SELF | Only the member themselves can edit their own profile |
- Kotlin
- Java
val channel = GroupChannel("groupId")
val params = SetGroupMemberInfoParams(
userId = "userId1",
nickname = "New Nickname",
extra = "Additional member info"
)
channel.setMemberInfo(params) { failedKeys, error ->
if (error == null) {
// Successfully updated
} else {
// Failed
}
}
GroupChannel channel = new GroupChannel("groupId");
SetGroupMemberInfoParams params = new SetGroupMemberInfoParams("userId1", "New Nickname", "Additional member info");
channel.setMemberInfo(params, (failedKeys, error) -> {
if (error == null) {
// Successfully updated
} else {
// Failed
}
});
Channel admins
Add or remove channel admins.
Add channel admins
Use groupChannel.addManagers() to assign channel admin roles.
On success, all members receive an onGroupOperation callback with operation type GroupOperation.ADD_MANAGER.
- Only the channel owner can add admins.
- The member must already be in the group. The owner cannot be set as an admin.
- Maximum 10 admins per group.
- Kotlin
- Java
val channel = GroupChannel("groupId")
val userIds = listOf("userId1", "userId2", "userId3")
channel.addManagers(userIds) { error ->
if (error == null) {
// Successfully added
} else {
// Failed
}
}
GroupChannel channel = new GroupChannel("groupId");
List<String> userIds = Arrays.asList("userId1", "userId2", "userId3");
channel.addManagers(userIds, error -> {
if (error == null) {
// Successfully added
} else {
// Failed
}
});
Remove channel admins
Use groupChannel.removeManagers() to remove admin roles. Supports batch removal of up to 10 users.
On success, all members receive an onGroupOperation callback with operation type GroupOperation.REMOVE_MANAGER.
Only the channel owner can remove admins.
- Kotlin
- Java
val channel = GroupChannel("groupId")
val userIds = listOf("userId1", "userId2", "userId3")
channel.removeManagers(userIds) { error ->
if (error == null) {
// Successfully removed
} else {
// Failed
}
}
GroupChannel channel = new GroupChannel("groupId");
List<String> userIds = Arrays.asList("userId1", "userId2", "userId3");
channel.removeManagers(userIds, error -> {
if (error == null) {
// Successfully removed
} else {
// Failed
}
});
Favorites (follow users)
Add, remove, or query followed members in a group.
- Maximum 200 followed members per group.
- Messages from followed members bypass the Do Not Disturb setting and trigger notifications normally.
- Push priority: App-level DND (no push) > Silent message flag > Followed user > Channel DND setting.
- See Do Not Disturb Overview for details.
- On success, other devices for the same user receive an
onGroupFavoritesChangedSynccallback.
Add to favorites
Use groupChannel.addFavorites() to follow channel members. Supports batch addition of up to 100 users.
- Kotlin
- Java
val channel = GroupChannel("groupId")
val userIds = listOf("userId1", "userId2", "userId3")
channel.addFavorites(userIds) { error ->
if (error == null) {
// Successfully added
} else {
// Failed
}
}
GroupChannel channel = new GroupChannel("groupId");
List<String> userIds = Arrays.asList("userId1", "userId2", "userId3");
channel.addFavorites(userIds, error -> {
if (error == null) {
// Successfully added
}
});
Remove from favorites
Use groupChannel.removeFavorites() to unfollow channel members. Supports batch removal of up to 100 users.
- Kotlin
- Java
val channel = GroupChannel("groupId")
val userIds = listOf("userId1", "userId2", "userId3")
channel.removeFavorites(userIds) { error ->
if (error == null) {
// Successfully removed
}
}
GroupChannel channel = new GroupChannel("groupId");
List<String> userIds = Arrays.asList("userId1", "userId2", "userId3");
channel.removeFavorites(userIds, error -> {
if (error == null) {
// Successfully removed
}
});
Query favorites
Use groupChannel.getFavorites() to retrieve the list of followed members in a group.
- Kotlin
- Java
val channel = GroupChannel("groupId")
channel.getFavorites { follows, error ->
if (error == null && follows != null) {
follows.forEach { follow ->
println("Followed user: ${follow.userId}")
}
}
}
GroupChannel channel = new GroupChannel("groupId");
channel.getFavorites((follows, error) -> {
if (error == null && follows != null) {
for (GroupFollowDetail follow : follows) {
System.out.println("Followed user: " + follow.getUserId());
}
}
});