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
groupIDstring[]YesIDs of the groups to query.
handleResultsnumber[]YesApplication processing results to include.
offsetnumberYesStarting offset. Pass 0 for the first page.
countnumberYesMaximum number of applications to retrieve.
Enum valueNumeric valueMeaning
ApplicationHandleResult.Unprocessed0Pending.
ApplicationHandleResult.Agree1Accepted.
ApplicationHandleResult.Reject-1Rejected.
import { ApplicationHandleResult } from '@openim/wasm-client-sdk';

const { data: applications } =
  await openimsdk.getGroupApplicationListAsRecipient({
    groupID: [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 forms the merge key for the application record.
nicknamestringSnapshot of the applicant's nickname.
userFaceURLstringSnapshot of the applicant's avatar URL.
reqMsgstringMessage included with the application.
reqTimenumberTime when the application was submitted.
joinSourceGroupJoinSourceSource of the application, such as search or a QR code.
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. Do not treat it as valid while the application is pending.
groupNamestringSnapshot of the target group's name.
groupFaceURLstringSnapshot of the target group's avatar URL.
groupTypeGroupTypeType of the target group.
ownerUserIDstringUser ID of the target group's owner.
creatorUserIDstringUser ID of the target group's creator.
introductionstringSnapshot of the target group's introduction.
notificationstringSnapshot of the target group's announcement.
memberCountnumberSnapshot of the target group's member count.
statusGroupStatusSnapshot of the target group's status.
createTimenumberTime when the application record was created.
exstringExtension string stored with the application record.

The applicant and group profiles are snapshots stored with the application. If you need to display current information, query the user profile and group profile separately. Do not write the nickname, avatar, or member count from an application back to the corresponding entity cache.

Listen for application changes

This page is the canonical reference for group application event listeners. Use groupID:userID as the merge key for an application record:

import { CbEvents } 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(CbEvents.OnGroupApplicationAdded, handlers.added);
openimsdk.on(CbEvents.OnGroupApplicationAccepted, handlers.accepted);
openimsdk.on(CbEvents.OnGroupApplicationRejected, handlers.rejected);
openimsdk.on(CbEvents.OnGroupApplicationDeleted, handlers.deleted);
openimsdk.on(
  CbEvents.OnGroupApplicationBadgeCountChanged,
  handlers.badgeChanged,
);

function removeGroupApplicationListeners() {
  openimsdk.off(CbEvents.OnGroupApplicationAdded, handlers.added);
  openimsdk.off(CbEvents.OnGroupApplicationAccepted, handlers.accepted);
  openimsdk.off(CbEvents.OnGroupApplicationRejected, handlers.rejected);
  openimsdk.off(CbEvents.OnGroupApplicationDeleted, handlers.deleted);
  openimsdk.off(
    CbEvents.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.