SDKsReact Native
Send a friend request
Dispatch an outgoing friend application to a specified user using the OpenIM React Native SDK.
Dispatch a friend request to a target user with an optional verification greeting:
await OpenIMSDK.addFriend({
toUserID,
reqMsg,
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
toUserID | string | Yes | Target user ID to add as a friend. |
reqMsg | string | Yes | Request 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.
Was this page helpful?