SDKsWASM
Add a user to the blacklist
Add a selected user to the current account’s blacklist.
Add an account to the current user's blacklist when the user no longer wants to receive interactions from that account. toUserID is the ID of the user being added. ex is an optional application-defined extension string and can be omitted when no extension data is needed.
await openimsdk.addBlack({
toUserID,
ex: JSON.stringify({ source: 'profile' }),
});When the Promise resolves, the server has completed the add request, but the blacklist event may not have arrived yet. When OnBlackAdded arrives, use the userID in the event data to add or update the blacklist record. For the complete listener, see Get the blacklist. Handle duplicate additions, permission restrictions, and similar failures through the rejected Promise.
Was this page helpful?