Skip to main content

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 ValueRole
GroupMemberRole.UNDEFUndefined (queries all roles)
GroupMemberRole.NORMALChannel member
GroupMemberRole.MANAGERChannel admin
GroupMemberRole.OWNERChannel owner
kotlin
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
}
}
}

Get specific members

Use groupChannel.getMembers() to retrieve info for specific users in a group. Supports batch queries of up to 100 user IDs.

tip

You must be a member of the group to query member info.

kotlin
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}")
}
}
}

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
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
}
}
}

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 ValueDescription
OWNER_OR_MANAGER_OR_SELFChannel owner, admin, and the member themselves can edit
OWNER_OR_SELFChannel owner and the member themselves can edit
SELFOnly the member themselves can edit their own profile
kotlin
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
}
}

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.

tip
  • 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
val channel = GroupChannel("groupId")
val userIds = listOf("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.

tip

Only the channel owner can remove admins.

kotlin
val channel = GroupChannel("groupId")
val userIds = listOf("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 onGroupFavoritesChangedSync callback.

Add to favorites

Use groupChannel.addFavorites() to follow channel members. Supports batch addition of up to 100 users.

kotlin
val channel = GroupChannel("groupId")
val userIds = listOf("userId1", "userId2", "userId3")

channel.addFavorites(userIds) { error ->
if (error == null) {
// Successfully added
} else {
// Failed
}
}

Remove from favorites

Use groupChannel.removeFavorites() to unfollow channel members. Supports batch removal of up to 100 users.

kotlin
val channel = GroupChannel("groupId")
val userIds = listOf("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
val channel = GroupChannel("groupId")

channel.getFavorites { follows, error ->
if (error == null && follows != null) {
follows.forEach { follow ->
println("Followed user: ${follow.userId}")
}
}
}