Browse SDKs · WASM
SDKsWASMEnterprise

Set friend request permissions

Choose how requests to add the current account as a friend are handled.

Copy

addFriendPermission controls whether the current user must approve requests from other users. This account-level policy is an Enterprise capability and should not be saved together with ordinary profile fields such as nickname and avatar.

import { AddFriendPermission } from '@openim/wasm-client-sdk';

await openimsdk.setSelfInfo({
  addFriendPermission: AddFriendPermission.AddFriendAllowed,
});
Enum valueNumeric valueMeaning
AddFriendPermission.AddFriendAllowed0Allow requests, but require the current user to approve them.
AddFriendPermission.AddFriendAllowedNoReview1Allow the relationship to be created without approval from the current user.
AddFriendPermission.AddFriendDenied2Do not allow other users to add the current account.

This setting affects only subsequent attempts to add the account. It does not remove existing friendships or automatically process pending applications.

A successful Promise means that the update request has completed, not that OnSelfInfoUpdated has arrived. See Update your profile for the event listener and getSelfUserInfo() reconciliation flow.