SDKsHarmonyOSEnterprise
Accept friend application
Approve a pending friend request from a designated user.
Accept an incoming friend request by supplying the applicant's user ID:
Code example
import sdk, { ApprovalStatus, HandleFriendApplicationReq } from '@openimsdk/imsdk';
const request: HandleFriendApplicationReq = {
userID: applicantUserID,
handleMsg: '',
status: ApprovalStatus.Approved,
};
await sdk.handleFriendApplication(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | string | Yes | Applicant's user identifier. |
handleMsg | string | No | Optional acceptance note or greeting message. |
status | ApprovalStatus | Yes | Use ApprovalStatus.Approved (1) to accept the request. |
Return value
Returns a Promise that resolves to void when the approval is processed on the server.
State changes after the call
Resolving the Promise confirms approval on the server. Update the application status in your request view via EventOnFriendApplicationAccepted correlated by fromUserID:toUserID, as described in Retrieve received friend applications. The newly established friendship triggers EventOnFriendAdded; see Paginate friend list for directory synchronization.
Was this page helpful?