SDKsHarmonyOSEnterprise
Reject friend application
Decline a pending friend request from a designated user.
Decline an incoming friend application with an optional rejection reason note:
Code example
import sdk, { ApprovalStatus, HandleFriendApplicationReq } from '@openimsdk/imsdk';
const request: HandleFriendApplicationReq = {
userID: applicantUserID,
handleMsg: rejectReason,
status: ApprovalStatus.Rejected,
};
await sdk.handleFriendApplication(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | string | Yes | Applicant's user identifier. |
handleMsg | string | No | Optional rejection explanation note. |
status | ApprovalStatus | Yes | Use ApprovalStatus.Rejected (-1) to decline the request. |
Return value
Returns a Promise that resolves to void upon submission of the rejection.
State changes after the call
Resolving the Promise submits the rejection to the server. Listen for EventOnFriendApplicationRejected to update the application item in your list matching fromUserID:toUserID, as described in Retrieve received friend applications. Declining does not establish a friendship or delete the application record from history.
Was this page helpful?