Browse SDKs · React Native
SDKsReact Native

Send a friend application

Send a friend request with the OpenIM React Native SDK.

Copy

Call addFriend() to send a friend request to a specified user.

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

Parameter description

ParameterTypeRequiredDescription
toUserIDstringYesUser ID to add.
reqMsgstringYesMessage attached to the request. Pass an empty string when there is no message.

A successful call means that the friend request was submitted; it does not mean that the recipient has accepted it. For request status changes, see the listener examples in Get received friend requests.