Browse SDKs · uni-app / uni-app x
SDKsuni-app

Set global message reception

Set the commercial account-wide globalRecvMsgOpt profile field.

Copy

globalRecvMsgOpt is an Enterprise field that defines the account's default message-reception and notification policy. It is not an ordinary nickname, avatar, or display-profile field.

import {
  setSelfInfo,
  type OpenIMSetSelfInfoRecvMsgOpt,
} from '@/uni_modules/unix-openim-sdk'

const receiveWithoutNotification : OpenIMSetSelfInfoRecvMsgOpt = 2
await setSelfInfo({
  globalRecvMsgOpt: receiveWithoutNotification,
})

The contract permits these values:

ValueMeaning
0Receive messages normally and allow offline push or notifications.
1Do not receive messages. Use only when the product explicitly needs to stop delivery and the server policy is understood.
2Receive messages without offline push or notifications, equivalent to all-day do not disturb.

Pass only globalRecvMsgOpt so changing message policy does not overwrite nickname, avatar, or ex. The plugin has no separate setter for this field.

A conversation's recvMsgOpt is a more specific conversation-level option; see Set message reception for a conversation. When account and conversation settings coexist, display the final conversation state returned by the server rather than inferring it only from a local switch.

Promise success means that the update request completed, not that onSelfInfoUpdated has arrived. See Update your profile for the event and getSelfUserInfo() reconciliation. Public editions may omit this field; show the control according to capability configuration and do not interpret absence as a particular policy.