Skip to main content

Set Do Not Disturb by Conversation

This document describes how to set the Do Not Disturb level for a specified conversation (targetId).

tip

The Instant Messaging client SDK supports multi-dimensional and multi-level Do Not Disturb settings.

  • App developers can implement Do Not Disturb configurations at multiple levels, including App Key, specific business segments (only for ultra groups), and user levels. When RC's server decides whether to trigger push notifications, the priority of different levels is as follows: User-level settings > Default configuration for specified ultra group channels (only supported for ultra groups) > Default configuration for specified ultra group conversations (only supported for ultra groups) > App Key-level settings.
  • User-level settings include multiple dimensions. When RC's server decides whether to trigger push notifications, if user-level configurations exist, the priority of different dimensions is as follows: Global Do Not Disturb > Do Not Disturb by Channel > Do Not Disturb by Conversation > Do Not Disturb by Conversation Type. For more details, refer to Do Not Disturb Overview.

When Do Not Disturb is active, the client behavior upon receiving new messages is as follows:

  • Client running in the background: When there is a new message in the conversation, the message content can be received. You need to implement the local notification pop-up yourself.
  • Client offline: When there is a new message in the conversation, no remote notification reminder will be received. The message content can be retrieved upon reconnection.

Supported Do Not Disturb Levels

Do Not Disturb levels provide control over different @ message notifications. Starting from SDK 5.2.2, the Do Not Disturb configuration for specified conversations supports the following levels:

Enum ValueValueDescription
RCPushNotificationLevelAllMessage-1All messages can trigger notifications.
RCPushNotificationLevelDefault0Not set. This is the initial state when no setting is applied.

Note: In this state, if both the ultra group and group channel are not set, the default Do Not Disturb level for the ultra group and channel is considered to be all messages triggering notifications.
RCPushNotificationLevelMention1Only @ messages trigger notifications, including @specific users and @all.
RCPushNotificationLevelMentionUsers2Only @specific user messages trigger notifications, and only the specified @ users receive notifications.

For example: @张三, then 张三 can receive the push; @all will not trigger a push notification.
RCPushNotificationLevelMentionAll4Only @all messages trigger notifications, i.e., only @all push notifications are received.
RCPushNotificationLevelBlocked5No notifications are received, even for @ messages.

SDK versions earlier than 5.2.2 only support setting to Do Not Disturb state (no push notifications) or reminder state (receive push notifications).

Manage Do Not Disturb Settings for Conversations

Instant Messaging users (userId) can set the Do Not Disturb level for specified conversations (targetId), supporting one-to-one chat, group chat, and ultra group conversations.

Set Do Not Disturb Level for a Specified Conversation (SDK >= 5.2.2)

tip

This interface is available in RCChannelClient starting from version 5.2.2.

Set the Do Not Disturb level for the specified conversation (targetId) for the current user.


[[RCChannelClient sharedChannelManager] setConversationNotificationLevel:"Conversation Type"
targetId:"Conversation Id"
level:RCPushNotificationLevelDefault
success:^() {}
error:^(RCErrorCode status) {}];
ParameterTypeDescription
conversationTypeRCConversationTypeConversation type. Note the following limitations:
  • Ultra group conversation type: If the ultra group service was activated before 2022.09.01, setting the Do Not Disturb level for all messages in a single ultra group conversation (all messages refer to messages in all channels and messages not belonging to any channel) is not supported by default. This interface only sets the Do Not Disturb level for messages in the specified ultra group conversation (targetId) that do not belong to any channel. Submit a ticket if modifications are needed.
  • Chatroom conversation type: Not supported, as chatroom messages do not support push notifications by default.
targetIdNSStringConversation ID
levelRCPushNotificationLevel
  • -1: All messages trigger notifications
  • 0: Not set (if not set by the user, the default setting of the group or APP level applies; if not set, all messages trigger notifications)
  • 1: Only @ messages trigger notifications
  • 2: Only @specific user messages trigger notifications

    For example: @张三 then 张三 can receive the push; @all will not trigger a push.

  • 4: Only @all messages trigger notifications, i.e., only @all push notifications are received.
  • 5: No notifications are received
successBlockblockCallback interface
errorBlockblockCallback interface

Remove Do Not Disturb Level for a Specified Conversation (SDK >= 5.2.2)

To remove the Do Not Disturb setting for a specified conversation type, call the setting interface and pass RCPushNotificationLevelDefault for the level parameter.

Query Do Not Disturb Level for a Specified Conversation (SDK >= 5.2.2)

tip

This interface is available in RCChannelClient starting from version 5.2.2.

Query the Do Not Disturb level set by the current user for the specified conversation (targetId).

[[RCChannelClient sharedChannelManager] getConversationNotificationLevel: "Conversation Type"
targetId: "Conversation Id"
success:^(RCPushNotificationLevel level) {}
error:^(RCErrorCode status) {}];
ParameterTypeDescription
conversationTypeRCConversationTypeConversation type
targetIdStringConversation Id
successBlockblockCallback interface
errorBlockblockCallback interface

Get Do Not Disturb Status List

tip

This interface is available in RCIMClient.

Get all conversations with Do Not Disturb enabled. The returned RCConversation list does not include specific Do Not Disturb level information or channel information.

NSArray *array = [[RCIMClient sharedRCIMClient] getBlockedConversationList:@[@(ConversationType_PRIVATE)]];
ParameterTypeDescription
conversationTypeListNSArrayArray of conversation types, convert RCConversationType to NSNumber to build the Array