Set message receive option
Configure message reception and notification behavior for a specific conversation.
The recvMsgOpt property controls message reception and alerting for an individual conversation, commonly used to implement per-chat Do Not Disturb (DND) or muting.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Identifier of the target conversation. |
recvMsgOpt | OpenIMMessageReceiveOption | Yes | Target message reception policy enum. |
Message receive options
| Enum value | Numeric value | Description |
|---|---|---|
OpenIMMessageReceiveOptionReceive | 0 | Receive messages normally and trigger notifications. |
OpenIMMessageReceiveOptionDoNotReceive | 1 | Block and reject incoming messages for this conversation. |
OpenIMMessageReceiveOptionReceiveWithoutNotification | 2 | Receive incoming messages silently without sound or notification alerts (Mute). |
Code example
import {
OpenIMMessageReceiveOptionReceiveWithoutNotification,
setConversation,
} from '@/uni_modules/unix-openim-sdk'
await setConversation({
conversationID,
recvMsgOpt: OpenIMMessageReceiveOptionReceiveWithoutNotification,
})Conversation-level reception options operate independently from the global user notification policy configured in Set global message reception.
Return value
The Promise resolves with void upon successful completion.
State changes after the call
Promise resolution, conversation change event arrival, and re-querying the conversation are three distinct lifecycle stages. Update your local state optimistically or wait for onConversationChanged, merging the updated recvMsgOpt by conversationID. For the centralized conversation listener implementation, see Retrieve conversation list.
Was this page helpful?