Set global message reception
Configure the account-wide default message receiving and notification option.
The globalRecvMsgOpt field governs the account-wide default notification policy, operating independently of user nicknames or avatars. Standard interfaces provide the following two options:
Code example
import sdk, { GlobalRecvMsgOpt, SetSelfInfoReq } from '@openimsdk/imsdk';
const request: SetSelfInfoReq = {
userID: currentUserID,
globalRecvMsgOpt: GlobalRecvMsgOpt.NotNotify,
};
await sdk.setSelfInfo(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | string | Yes | Signed-in user identifier. |
globalRecvMsgOpt | GlobalRecvMsgOpt | Yes | Global notification preference enum value. |
| Option | Value | Description |
|---|---|---|
GlobalRecvMsgOpt.Normal | 0 | Normal message reception with push notifications. |
GlobalRecvMsgOpt.NotNotify | 2 | Receive messages silently without notifications (account-wide DND). |
To disable global DND, reset the property back to GlobalRecvMsgOpt.Normal.
Return value
Returns a Promise that resolves to void when the setting is updated.
State changes after the call
Per-conversation reception settings provide finer granularity; see Set message receive option. When both global and conversation settings exist, evaluate the final delivery behavior from the conversation's recvMsgOpt. After the Promise resolves, await EventOnSelfInfoUpdated or re-query via Retrieve current user profile.
Was this page helpful?