Get received group applications
Retrieve group applications that the current user is authorized to process.
Group owners and administrators can call getGroupApplicationListAsRecipient() to retrieve the group applications they have received.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupIDs | string[] | Yes | IDs of the groups to query. Pass an empty array to query every group the current user is authorized to manage. |
handleResults | number[] | Yes | Application processing results to include. Pass an empty array to include every result. |
offset | number | Yes | Starting offset. Pass 0 for the first page. |
count | number | Yes | Maximum number of applications to retrieve. |
| Enum value | Numeric value | Meaning |
|---|---|---|
ApplicationHandleResult.Unprocessed | 0 | Pending. |
ApplicationHandleResult.Accepted | 1 | Accepted. |
ApplicationHandleResult.Rejected | -1 | Rejected. |
import { ApplicationHandleResult } from '@openim/wasm-client-sdk';
const { data: applications } =
await openimsdk.getGroupApplicationListAsRecipient({
groupIDs: [groupID],
handleResults: [ApplicationHandleResult.Unprocessed],
offset: 0,
count: 20,
});Return result
When the Promise resolves, data is a GroupApplicationItem[] containing applications that the current user is authorized to process. This query does not trigger any events.
Group application fields
| Field | Type | Description |
|---|---|---|
groupID | string | ID of the group the user applied to join. |
userID | string | Applicant's user ID. Together with groupID, it identifies one application record. |
nickname | string | Applicant nickname stored with the application record. |
userFaceURL | string | Applicant avatar stored with the application record. |
reqMsg | string | Message included with the application. |
reqTime | number | Time when the application was submitted, as a Unix timestamp in milliseconds. |
joinSource | GroupJoinSource | Source of the application, such as search or a QR code. |
inviterUserID | string (optional) | User ID of the inviter for invitation-based joins. It may be empty for a self-submitted application. |
handleResult | ApplicationHandleResult | Current result: pending, accepted, or rejected. |
handleUserID | string | User ID of the owner or administrator who processed the application. It may be empty while the application is pending. |
handledMsg | string | Message provided when the application was processed. |
handledTime | number | Processing time as a Unix timestamp in milliseconds. Do not treat it as valid while the application is pending. |
groupName | string | Target group name stored with the application record. |
groupFaceURL | string | Target group avatar stored with the application record. |
groupType | GroupType | Type of the target group. |
ownerUserID | string | User ID of the target group's owner. |
creatorUserID | string | User ID of the target group's creator. |
introduction | string | Target group introduction stored with the application record. |
notification | string | Target group announcement stored with the application record. |
memberCount | number | Target group member count stored with the application record. |
status | GroupStatus | Target group status stored with the application record. |
createTime | number | Time when the application record was created, as a Unix timestamp in milliseconds. |
ex | string | Extension string stored with the application record. |
attachedInfo | string (optional) | SDK attachment data. Parse it only according to a confirmed application contract. |
The applicant and group details are stored with the application record and may not be current. If you need to display the latest information, query the user profile and group profile separately. Do not overwrite the current user or group profile with the nickname, avatar, or member count from an application.
Listen for application changes
This page provides the complete group application event listeners. Use groupID:userID to identify an application record:
import { SdkEvent } from '@openim/wasm-client-sdk';
const handlers = {
added: ({ data }) => mergeGroupApplication(data),
accepted: ({ data }) => mergeGroupApplication(data),
rejected: ({ data }) => mergeGroupApplication(data),
deleted: ({ data }) => removeGroupApplication(data),
badgeChanged: ({ data }) => updateGroupApplicationBadge(data),
};
openimsdk.on(SdkEvent.OnGroupApplicationAdded, handlers.added);
openimsdk.on(SdkEvent.OnGroupApplicationAccepted, handlers.accepted);
openimsdk.on(SdkEvent.OnGroupApplicationRejected, handlers.rejected);
openimsdk.on(SdkEvent.OnGroupApplicationDeleted, handlers.deleted);
openimsdk.on(
SdkEvent.OnGroupApplicationBadgeCountChanged,
handlers.badgeChanged,
);
function removeGroupApplicationListeners() {
openimsdk.off(SdkEvent.OnGroupApplicationAdded, handlers.added);
openimsdk.off(SdkEvent.OnGroupApplicationAccepted, handlers.accepted);
openimsdk.off(SdkEvent.OnGroupApplicationRejected, handlers.rejected);
openimsdk.off(SdkEvent.OnGroupApplicationDeleted, handlers.deleted);
openimsdk.off(
SdkEvent.OnGroupApplicationBadgeCountChanged,
handlers.badgeChanged,
);
}If an application is added, processed, or deleted while you are paging through the list, reset pagination and reload from the first page. Call removeGroupApplicationListeners() when the component unmounts, the user logs out, or the active account changes.
Was this page helpful?