Browse SDKs · WASM
SDKsWASM

Get received group applications

Retrieve group applications that the current user is authorized to process.

Copy

Group owners and administrators can call getGroupApplicationListAsRecipient() to retrieve the group applications they have received.

Parameters

ParameterTypeRequiredDescription
groupIDsstring[]YesIDs of the groups to query. Pass an empty array to query every group the current user is authorized to manage.
handleResultsnumber[]YesApplication processing results to include. Pass an empty array to include every result.
offsetnumberYesStarting offset. Pass 0 for the first page.
countnumberYesMaximum number of applications to retrieve.
Enum valueNumeric valueMeaning
ApplicationHandleResult.Unprocessed0Pending.
ApplicationHandleResult.Accepted1Accepted.
ApplicationHandleResult.Rejected-1Rejected.
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

FieldTypeDescription
groupIDstringID of the group the user applied to join.
userIDstringApplicant's user ID. Together with groupID, it identifies one application record.
nicknamestringApplicant nickname stored with the application record.
userFaceURLstringApplicant avatar stored with the application record.
reqMsgstringMessage included with the application.
reqTimenumberTime when the application was submitted, as a Unix timestamp in milliseconds.
joinSourceGroupJoinSourceSource of the application, such as search or a QR code.
inviterUserIDstring (optional)User ID of the inviter for invitation-based joins. It may be empty for a self-submitted application.
handleResultApplicationHandleResultCurrent result: pending, accepted, or rejected.
handleUserIDstringUser ID of the owner or administrator who processed the application. It may be empty while the application is pending.
handledMsgstringMessage provided when the application was processed.
handledTimenumberProcessing time as a Unix timestamp in milliseconds. Do not treat it as valid while the application is pending.
groupNamestringTarget group name stored with the application record.
groupFaceURLstringTarget group avatar stored with the application record.
groupTypeGroupTypeType of the target group.
ownerUserIDstringUser ID of the target group's owner.
creatorUserIDstringUser ID of the target group's creator.
introductionstringTarget group introduction stored with the application record.
notificationstringTarget group announcement stored with the application record.
memberCountnumberTarget group member count stored with the application record.
statusGroupStatusTarget group status stored with the application record.
createTimenumberTime when the application record was created, as a Unix timestamp in milliseconds.
exstringExtension string stored with the application record.
attachedInfostring (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.