Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app xEnterprise

Set friend request permissions

Configure approval policies for incoming friend requests directed to the authenticated user.

Copy

The addFriendPermission property configures whether other users can add the current account directly, require approval, or are blocked from sending friend requests. This account-level setting is a commercial feature and should be configured through a dedicated privacy preference interface.

Parameters

The addFriendPermission parameter accepts values of type OpenIMAddFriendPermission:

Enum constantNumeric valueDescription
OpenIMAddFriendPermissionAllowed0Other users may submit friend requests, which require manual review by the current user.
OpenIMAddFriendPermissionAllowedNoReview1Other users can add this account as a friend immediately without manual approval.
OpenIMAddFriendPermissionDenied2Other users are blocked from submitting friend requests to this account.

Code example

import {
  OpenIMAddFriendPermissionAllowed,
  setSelfInfo,
} from '@/uni_modules/unix-openim-sdk'

await setSelfInfo({
  addFriendPermission: OpenIMAddFriendPermissionAllowed,
})

This configuration applies exclusively to subsequent friend requests. It does not alter existing friendships or auto-accept, reject, or purge pending friend applications.

Return value

The Promise resolves with void once OpenIMServer updates the account permission.

State changes after the call

A resolved Promise confirms that the policy has been updated on OpenIMServer. It does not mean the user profile update event has finished propagating to other active clients. For event registration and userID cache updating, see Update your profile. To verify the active policy immediately, invoke Get your profile and inspect addFriendPermission.