Browse SDKs · WASM
SDKsWASM

Accept a friend application

Accept a friend application from a selected user.

Copy

When processing a received friend application, set toUserID to the applicant's user ID, not the current user's ID. handleMsg is an optional message attached to the decision; pass an empty string when no message is needed.

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

When the Promise resolves, the server has completed the accept request. The application record and the friendship are separate records: update the application when its status-change event arrives, and add the friend by userID only when OnFriendAdded arrives. For the complete event flows, see Get received friend applications and Get friends by page.