Browse SDKs · React Native
SDKsReact Native

Get received group applications

OpenIM React Native SDK guide for get received group applications.

Copy

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

const applications = await OpenIMSDK.getGroupApplicationListAsRecipient({
  groupIDs: ['group-001'],
  handleResults: [ApplicationHandleResult.Unprocessed],
  offset: 0,
  count: 20,
});

Parameters

| Parameter | Type | Required | Description | | --- | --- | --- | | groupIDs | string[] | Yes | Group IDs to retrieve applications for. Pass an empty array to skip filtering by group. | | handleResults | number[] | Yes | Application results to retrieve. Pass an empty array to skip filtering by result. | | offset | number | Yes | Pagination offset. Use 0 for the first page. | | count | number | Yes | Number of applications to retrieve. |

Common ApplicationHandleResult values are:

Enum valueValueMeaning
ApplicationHandleResult.Unprocessed0Pending.
ApplicationHandleResult.Agree1Accepted.
ApplicationHandleResult.Reject-1Rejected.

Return value

When the call completes, it returns GroupApplicationItem[] that the current account can handle.

Group application fields

FieldTypeDescription
groupIDstringID of the group that the user applied to join.
userIDstringUser ID of the applicant.
nicknamestringApplicant nickname recorded in the application.
userFaceURLstringApplicant avatar URL recorded in the application.
reqMsgstringApplication message.
reqTimenumberApplication time.
joinSourceGroupJoinSourceSource of the group application.
handleResultApplicationHandleResultCurrent handling result.
handleUserIDstringUser ID of the person who handled the application.
handledMsgstringMessage entered while handling the application.
handledTimenumberTime when the application was handled.
groupNamestringGroup name recorded in the application.
groupFaceURLstringGroup avatar URL recorded in the application.
groupTypeGroupTypeGroup type.
ownerUserIDstringGroup owner user ID.
creatorUserIDstringGroup creator user ID.
introductionstringGroup description recorded in the application.
notificationstringGroup announcement recorded in the application.
memberCountnumberGroup member count recorded in the application.
statusGroupStatusGroup status.
createTimenumberApplication record creation time as a Unix timestamp in milliseconds.
exstringApplication record extension string.

The nickname, avatar, and group information in an application record reflect the values when the record was created. Query the current user profile or group profile to show the latest information.

Listen for group application changes

When a group application is added, handled, or deleted, OnGroupApplicationAdded, OnGroupApplicationAccepted, OnGroupApplicationRejected, or OnGroupApplicationDeleted is triggered respectively. Each callback receives a GroupApplicationItem directly:

const handleApplicationChanged = (application: GroupApplicationItem) => {
  // Update the application record by groupID and userID
};

const handleApplicationDeleted = (application: GroupApplicationItem) => {
  // Delete the application record by groupID and userID
};

OpenIMSDK.on(OpenIMEvent.OnGroupApplicationAdded, handleApplicationChanged);
OpenIMSDK.on(OpenIMEvent.OnGroupApplicationAccepted, handleApplicationChanged);
OpenIMSDK.on(OpenIMEvent.OnGroupApplicationRejected, handleApplicationChanged);
OpenIMSDK.on(OpenIMEvent.OnGroupApplicationDeleted, handleApplicationDeleted);

OpenIMSDK.off(OpenIMEvent.OnGroupApplicationAdded, handleApplicationChanged);
OpenIMSDK.off(OpenIMEvent.OnGroupApplicationAccepted, handleApplicationChanged);
OpenIMSDK.off(OpenIMEvent.OnGroupApplicationRejected, handleApplicationChanged);
OpenIMSDK.off(OpenIMEvent.OnGroupApplicationDeleted, handleApplicationDeleted);

Remove these listeners when signing out, switching accounts, or discarding application-list state.