Skip to main content

Set Do Not Disturb by Channel

This document describes how to set the Do Not Disturb level for a specified channel (channelId) in the Ultra Group business.

tip

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

  • App developers can configure Do Not Disturb functionality across multiple dimensions: App Key, specified business segments (only for Ultra Groups), and user level. When 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 (only for Ultra Groups) > Default Configuration for Specified Ultra Group Conversations (only for Ultra Groups) > App Key Level Settings.
  • User Level Settings include multiple sub-dimensions. When 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 > Do Not Disturb by Channel > Do Not Disturb by Conversation > Do Not Disturb by Conversation Type. For more details, see Do Not Disturb Function Overview.

When Do Not Disturb settings are in effect, the client behavior upon receiving new messages is as follows:

  • Client Running in Background: When there are new messages in the conversation, the message content can be received. You need to implement the local notification pop-up yourself.
  • Client Offline: When there are new messages in the conversation, no remote notification reminders will be received. The message content can be retrieved upon going online again.

Supported Do Not Disturb Levels

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

Enum ValueValueDescription
RCPushNotificationLevelAllMessage-1All messages can be notified.
RCPushNotificationLevelDefault0Not set. This is the initial state when not set.

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 to notify all messages.
RCPushNotificationLevelMention1Only notify @ messages, including @specific users and @all.
RCPushNotificationLevelMentionUsers2Only notify @specific user messages, and only notify the specified user who is @mentioned.

For example: @Zhang San, then Zhang San can receive the push; @all will not trigger a push notification.
RCPushNotificationLevelMentionAll4Only notify @all messages, i.e., only receive push notifications for @all.
RCPushNotificationLevelBlocked5Do not receive notifications, even for @ messages.

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

Manage Do Not Disturb Settings for Channels

Ultra Groups support creating independent channels (channels) under Ultra Group conversations, aggregating message data (conversations, messages, unread counts) and group members by channel. The SDK supports setting the Do Not Disturb level for specified group channels (channelId) by users (userId) in the Ultra Group business.

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

tip

This interface is in RCChannelClient and is supported starting from version 5.2.2.

Set the Do Not Disturb level for messages in the Ultra Group channel for the current user.

 [[RCChannelClient sharedChannelManager] setConversationChannelNotificationLevel:"Conversation Type"
targetId:" Conversation ID "
channelId:" Channel ID "
level:RCPushNotificationLevelDefault
success:^() {}
error:^(RCErrorCode status) {}];
ParameterTypeDescription
conversationTypeRCConversationTypeConversation type.
targetIdNSStringConversation ID
channelIdNSStringThe channel ID of the Ultra Group conversation.
  • If a channel ID is passed, the Do Not Disturb level is set for the specified channel.
  • Note: For customers who activated the Ultra Group business before 2022.09.01, if no channel ID is specified, an empty string "" is passed by default, meaning the Do Not Disturb level is set for messages in the specified Ultra Group conversation (targetId) that do not belong to any channel. Please submit a ticket if modifications are needed.
levelRCPushNotificationLevel
  • -1: Notify all messages
  • 0: Not set (if the user has not set, the default setting of the group or APP level is used. If not set, all messages are notified)
  • 1: Only notify @ messages
  • 2: Only notify @specific user messages

    For example: @Zhang San then Zhang San can receive the push, @all will not receive the push.

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

Get Do Not Disturb Level for Specified Channel (SDK >= 5.2.2)

Get the Do Not Disturb level set for the Ultra Group channel for the current user.

 [[RCChannelClient sharedChannelManager] getConversationChannelNotificationLevel::"Conversation Type"
targetId:" Conversation ID "
channelId:" Channel ID "
success:^(RCPushNotificationLevel level) {}
error:^(RCErrorCode status) { }];
ParameterTypeDescription
conversationTypeRCConversationTypeConversation type
targetIdNSStringConversation ID
channelIdNSStringThe channel ID of the Ultra Group conversation, get the setting for the specified channel of the conversation.
successBlockblockCallback interface
errorBlockblockCallback interface