Browse SDKs · React Native
Platform
SDKsReact Native

Send a friend request

Dispatch an outgoing friend application to a specified user using the OpenIM React Native SDK.

Copy

Dispatch a friend request to a target user with an optional verification greeting:

await OpenIMSDK.addFriend({
  toUserID,
  reqMsg,
});

Parameters

ParameterTypeRequiredDescription
toUserIDstringYesTarget user ID to add as a friend.
reqMsgstringYesRequest message or greeting. Pass empty string "" if not needed.

Return value

A resolved Promise confirms that the friend request was submitted to the server.

A successful Promise resolution indicates only that the request was delivered to the backend, not that the recipient has accepted it. Once processed by the recipient, the caller receives OnFriendApplicationAccepted or OnFriendApplicationRejected. If accepted, OnFriendAdded is triggered. Reconcile new friendships using userID. For event handling, see Get received friend applications.