Browse SDKs · WASM
SDKsWASM

Set global message reception

Set the current account’s default message reception and notification behavior for all conversations.

Copy

globalRecvMsgOpt is the account-level default. It controls whether the current account receives messages and allows notifications; it is separate from ordinary profile fields such as nickname and avatar.

import { MessageReceiveOptType } from '@openim/wasm-client-sdk';

await openimsdk.setSelfInfo({
  globalRecvMsgOpt: MessageReceiveOptType.NotNotify,
});
Enum valueNumeric valueMeaning
MessageReceiveOptType.Normal0Receive messages normally and allow offline push notifications or other notifications.
MessageReceiveOptType.NotNotify2Receive messages without triggering offline push notifications or other notifications.

Global message reception currently uses Normal and NotNotify: Normal disables do not disturb, while NotNotify enables it.

The conversation-level recvMsgOpt provides a more granular setting. See Set conversation message reception. When both account-level and conversation-level settings exist, display the final conversation state returned by the server instead of inferring it from local switches alone.

A successful Promise means that the update request has completed, not that OnSelfInfoUpdated has arrived. See Update your profile for the event listener and getSelfUserInfo() reconciliation flow.