Browse SDKs · React Native
SDKsReact NativeEnterprise

Set friend request permissions

Set friend request permissions with the OpenIM React Native SDK.

Copy

addFriendPermission controls whether users who add the current account must wait for the current user to review the request. Use setSelfInfo() to update this account-level setting:

await OpenIMSDK.setSelfInfo({
  addFriendPermission: AddFriendPermission.AddFriendAllowed,
});

Parameter description

Enum valueNumeric valueDescription
AddFriendPermission.AddFriendAllowed0Allow requests, but require the current user to review them.
AddFriendPermission.AddFriendAllowedNoReview1Allow requests and establish the friendship without review.
AddFriendPermission.AddFriendDenied2Do not allow other users to add the current account.

This setting applies to future add-friend actions. It does not remove existing friends or automatically process pending requests. After the setting is updated, the current-user information is delivered through OnSelfInfoUpdated; see Update your profile for the listener example.