Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app x

Reject a friend application

Decline an incoming friend request from a specified user.

Copy

Invoke refuseFriendApplication() to reject an incoming friend request. When processing an incoming application, pass the applicant's user ID as toUserID.

Parameters

ParameterTypeRequiredDescription
toUserIDstringYesThe user ID of the applicant whose request is being rejected.
handleMsgstringYesReason or note explaining the rejection; pass an empty string if omitted.

Code example

import { refuseFriendApplication } from '@/uni_modules/unix-openim-sdk'

await refuseFriendApplication({
  toUserID: applicantUserID,
  handleMsg: '',
})

Return value

The Promise resolves with void once OpenIMServer processes the rejection.

State changes after the call

A resolved Promise indicates that the server accepted the rejection; it does not indicate that the rejection event has arrived at all clients. Upon receiving onFriendApplicationRejected, update the application status indexed by fromUserID:toUserID. Rejecting an application does not form a friendship or remove the application log from history. For complete event registration logic, see Get received friend applications.