Browse SDKs · React Native
Platform
SDKsReact Native

Accept a friend request

Accept an incoming friend application to establish a mutual friendship with the OpenIM React Native SDK.

Copy

Accept an incoming friend request from a specified applicant:

await OpenIMSDK.acceptFriendApplication({
  toUserID: applicantUserID,
  handleMsg: '',
});

Parameters

ParameterTypeRequiredDescription
toUserIDstringYesUser ID of the applicant who initiated the friend request.
handleMsgstringYesOptional response message attached to the approval. Pass an empty string "" if not needed.

Return value

A resolved Promise confirms that the friend application was accepted on the server.

Accepting a friend application creates a mutual friendship, emitting OnFriendApplicationAccepted and OnFriendAdded on both clients. Keyed by userID, insert the new friend record into your local friend list and update the application record status. For event listeners, see Get friend list by page.