Managing membership requests
This guide covers how to join groups, invite users, accept or reject join requests, and manage membership approvals using the Nexconn SDK.
Joining a group
Join a group directly
Use groupChannel.join() to request to join a group. The result depends on the group's joinPermission setting:
- Owner/admin approval required: The callback returns error code
25424, indicating the request is pending. Both the requester and the owner/admin receive anonGroupApplicationEventcallback. - No approval required: The callback returns
nullerror (success), indicating the user has joined. All members receive anonGroupOperationcallback with typeJoin.
- Kotlin
- Java
val channel = GroupChannel("groupId1")
channel.join { code, error ->
if (error == null) {
// Joined successfully (code == 0)
} else if (error.code == 25424) {
// Join request pending approval
} else {
// Request failed
}
}
GroupChannel channel = new GroupChannel("groupId1");
channel.join((code, error) -> {
if (error == null) {
// Joined successfully
} else if (error.getCode() == 25424) {
// Join request pending approval
} else {
// Request failed
}
});
Invite users to a group
Use groupChannel.inviteUsers() to invite users. Only users with the invitePermission role can use this API.
- Kotlin
- Java
val channel = GroupChannel("groupId1")
val userIds = listOf("userId1", "userId2", "userId3")
channel.inviteUsers(userIds) { code, error ->
if (error == null) {
// Invitation sent or user joined directly (code == 0)
} else if (error.code == 25424) {
// Approval required from owner/admin
} else if (error.code == 25427) {
// Invitee needs to accept
} else {
// Invitation failed
}
}
GroupChannel channel = new GroupChannel("groupId1");
List<String> userIds = Arrays.asList("userId1", "userId2", "userId3");
channel.inviteUsers(userIds, (code, error) -> {
if (error == null) {
// Invitation sent successfully
} else {
// Handle error
}
});
The invitation behavior depends on three factors:
- Join permission (
joinPermission): Whether owner/admin approval is required. - Inviter role (
role): Whether the inviter is an owner/admin or a regular member. - Invitee handling (
inviteHandlePermission): Whether invitees must accept the invitation.
Invitation flow rules
The table below assumes invitePermission is set to Everyone (all members can invite).
| Join Permission | Inviter Role | Invitee Approval | Flow |
|---|---|---|---|
| Owner/admin approval required | Regular member | Required | Flow A |
| Owner/admin approval required | Regular member | Not required | Flow B |
| Owner/admin approval required | Owner or admin | Required | Flow C |
| Owner/admin approval required | Owner or admin | Not required | Flow D |
| No approval required | Any role | Required | Flow C |
| No approval required | Any role | Not required | Flow D |
Flow a
Regular member invites, owner/admin approval required, invitee approval required.
- Invitation sent → error code
25424. The inviter and owner/admin receiveonGroupApplicationEvent. - Owner/admin approves → inviter, owner/admin, and invitee receive
onGroupApplicationEvent. - Invitee accepts → all members receive
onGroupOperationwith typeJoin.
Flow b
Regular member invites, owner/admin approval required, invitee approval not required.
- Invitation sent → error code
25424. The inviter and owner/admin receiveonGroupApplicationEvent. - Owner/admin approves → invitee joins automatically. All members receive
onGroupOperationwith typeJoin.
Flow c
Any role invites, no owner/admin approval needed, invitee approval required.
- Invitation sent → error code
25427. The inviter and invitee receiveonGroupApplicationEvent. - Invitee accepts → all members receive
onGroupOperationwith typeJoin.
Flow d
No approval from anyone is required.
- Invitation sent → success (null error). The invitee joins immediately. All members receive
onGroupOperationwith typeJoin.
Invitee handling
Accept an invitation
Use channel.acceptInvite(inviterId) (instance method) to accept a group invitation.
- Kotlin
- Java
val channel = GroupChannel("groupId1")
channel.acceptInvite("inviterUserId") { error ->
if (error == null) {
// Accepted
} else {
// Failed
}
}
GroupChannel channel = new GroupChannel("groupId1");
channel.acceptInvite("inviterUserId", error -> {
if (error == null) {
// Accepted
}
});
Reject an invitation
Use channel.refuseInvite(RefuseGroupInviteParams) (instance method) to decline a group invitation.
- Kotlin
- Java
val channel = GroupChannel("groupId1")
val params = RefuseGroupInviteParams(inviterId = "inviterUserId").apply {
reason = "Not interested"
}
channel.refuseInvite(params) { error ->
if (error == null) {
// Rejected
}
}
GroupChannel channel = new GroupChannel("groupId1");
RefuseGroupInviteParams params = new RefuseGroupInviteParams("inviterUserId");
params.setReason("Not interested");
channel.refuseInvite(params, error -> {
if (error == null) {
// Rejected
}
});
Owner/Admin handling
Membership requests expire after 7 days. The server stores request data for up to 7 days.
Approve a request
Use channel.acceptApplication(AcceptGroupApplicationParams) (instance method) to approve a join request.
- For a direct join request: pass the applicant's ID as
userId; leaveinviterIdasnull. - For an invitation request: pass both
userIdandinviterId.
- Kotlin
- Java
val channel = GroupChannel("groupId1")
val params = AcceptGroupApplicationParams(applicantId = "applicantUserId").apply {
inviterId = "inviterUserId" // null for direct join requests
}
channel.acceptApplication(params) { code, error ->
if (error == null) {
// Approved
} else if (error.code == 25427) {
// Invitee needs to accept
}
}
GroupChannel channel = new GroupChannel("groupId1");
AcceptGroupApplicationParams params = new AcceptGroupApplicationParams("applicantUserId");
params.setInviterId("inviterUserId");
channel.acceptApplication(params, (code, error) -> {
if (error == null) {
// Approved
} else if (error.getCode() == 25427) {
// Invitee needs to accept
}
});
Reject a request
Use channel.refuseApplication(RefuseGroupApplicationParams) (instance method) to reject a join request.
- Kotlin
- Java
val channel = GroupChannel("groupId1")
val params = RefuseGroupApplicationParams(applicantId = "applicantUserId").apply {
inviterId = "inviterUserId"
reason = "Group is full"
}
channel.refuseApplication(params) { error ->
if (error == null) {
// Rejected
}
}
GroupChannel channel = new GroupChannel("groupId1");
RefuseGroupApplicationParams params = new RefuseGroupApplicationParams("applicantUserId");
params.setInviterId("inviterUserId");
params.setReason("Group is full");
channel.refuseApplication(params, error -> {
if (error == null) {
// Rejected
}
});
Get membership request list (paginated)
Use GroupChannel.createGroupApplicationsQuery() with GroupApplicationsQueryParams to retrieve membership requests with pagination. Requests expire after 7 days.
- Kotlin
- Java
val params = GroupApplicationsQueryParams().apply {
pageSize = 20
isAscending = false
}
val query = GroupChannel.createGroupApplicationsQuery(params)
query.loadNextPage { page, error ->
if (error == null && page != null) {
page.data?.forEach { app ->
println("Applicant: ${app.joinMemberInfo?.userId}, Group: ${app.groupId}")
}
if (query.hasMore) {
query.loadNextPage { nextPage, nextError ->
// Handle next page
}
}
}
}
GroupApplicationsQueryParams params = new GroupApplicationsQueryParams();
params.setPageSize(20);
params.setAscending(false);
GroupApplicationsQuery query = GroupChannel.createGroupApplicationsQuery(params);
query.loadNextPage((page, error) -> {
if (error == null && page != null) {
for (GroupApplicationInfo app : page.getData()) {
System.out.println("Applicant: " + app.getJoinMemberInfo().getUserId());
}
if (query.getHasMore()) {
// Fetch next page
}
}
});