Skip to main content

Setting Do Not Disturb by Conversation Type

This document describes how to set Do Not Disturb levels for specified conversation types (conversationType).

tip

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

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

Supported Do Not Disturb Levels

Do Not Disturb levels provide control over different types of @ message notifications. Starting from SDK version 5.2.2.1, the following levels are supported for Do Not Disturb configurations by conversation type:

Enum ValueNumeric ValueDescription
RCPushNotificationLevelAllMessage-1All messages trigger notifications.
RCPushNotificationLevelDefault0Not set. This is the initial state when no setting is configured.

Note: In this state, if both ultra groups and group channels are unset, the default Do Not Disturb level for ultra groups and channels is considered to notify all messages.
RCPushNotificationLevelMention1Only @ messages trigger notifications, including @specific users and @all.
RCPushNotificationLevelMentionUsers2Only @specific user messages trigger notifications, and only the specified @mentioned users receive notifications.

Example: @ZhangSan will trigger a notification for ZhangSan, but @all will not trigger any notifications.
RCPushNotificationLevelMentionAll4Only @all messages trigger notifications, meaning only @all push notifications are received.
RCPushNotificationLevelBlocked5No notifications are received, even for @ messages.

SDK versions below 5.2.2.1 only support setting to Do Not Disturb state (no push notifications) or alert state (receive push notifications).

Managing Do Not Disturb Levels by Conversation Type

Starting from SDK version 5.2.2.1, users (userId) can set Do Not Disturb levels for specified conversation types (conversationType) in instant messaging, supporting one-to-one chat, group chat, and ultra group conversations.

Setting Do Not Disturb Level for Specified Conversation Type

tip

This interface is in the RCChannelClient class and is supported starting from version 5.2.2.1.

Set the Do Not Disturb level for a specified conversation type (conversationType) for a user, supporting one-to-one chat, group chat, and ultra group conversations.

Interface Prototype

- (void)setConversationTypeNotificationLevel:(RCConversationType)conversationType
level:(RCPushNotificationLevel)level
success:(nullable void (^)(void))successBlock
error:(nullable void (^)(RCErrorCode status))errorBlock;

Parameter Description

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type. Chatroom type is not supported because chatrooms do not accept message reminders by default.
levelRCPushNotificationLevel
  • -1: Notify all messages
  • 0: Not set (if the user has not set this, the default setting of the group or App level applies; if not set, all messages are notified)
  • 1: Only notify @ messages
  • 2: Only notify @specific users

    Example: @ZhangSan will trigger a notification for ZhangSan, but @all will not trigger any notifications.

  • 4: Only notify @all messages, meaning only @all push notifications are received.
  • 5: Do not receive notifications
successBlockblockCallback interface
errorBlockblockCallback interface

Example Code

[[RCChannelClient sharedChannelManager] setConversationTypeNotificationLevel:"会话类型"
level:RCPushNotificationLevelDefault
success:^() {}
error:^(RCErrorCode status) {}];

Removing Do Not Disturb Level for Specified Conversation Type

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

Querying Do Not Disturb Level for Specified Conversation Type

tip

This interface is in the RCChannelClient class and is supported starting from version 5.2.2.1.

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

Interface Prototype

- (void)getConversationTypeNotificationLevel:(RCConversationType)conversationType
success:(nullable void (^)(RCPushNotificationLevel level))successBlock
error:(nullable void (^)(RCErrorCode status))errorBlock;

Parameter Description

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type. Chatroom type is not supported because chatrooms do not accept message reminders by default.
levelRCPushNotificationLevel
  • -1: Notify all messages
  • 0: Not set (if the user has not set this, the default setting of the group or App level applies; if not set, all messages are notified)
  • 1: Only notify @ messages
  • 2: Only notify @specific users

    Example: @ZhangSan will trigger a notification for ZhangSan, but @all will not trigger any notifications.

  • 4: Only notify @all messages, meaning only @all push notifications are received.
  • 5: Do not receive notifications
successBlockblockCallback interface
errorBlockblockCallback interface

Example Code

[[RCChannelClient sharedChannelManager] getConversationTypeNotificationLevel:"会话类型"
success:^(RCPushNotificationLevel level) {}
error:^(RCErrorCode status) {}];