Set Do Not Disturb by Channel
This document describes how to set Do Not Disturb levels for specified channels (channelId) in Ultra Group services.
The IM client SDK supports multi-dimensional, multi-level Do Not Disturb settings.
- App developers can configure Do Not Disturb functionality across multiple dimensions: App Key, specified business segments (Ultra Group only), and user levels. When the RC server determines whether to trigger push notifications, the priority of different dimensions is as follows: User-level settings > Default configuration for specified Ultra Group channels (Ultra Group only) > Default configuration for specified Ultra Group conversations (Ultra Group only) > App Key-level settings.
- User-level settings include multiple sub-dimensions. When the RC server determines 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 notifications for different types of @ mentions. Starting from SDK 5.2.2, channel-specific Do Not Disturb configurations support the following levels:
| Enum Value | Numeric Value | Description |
|---|---|---|
| RCPushNotificationLevelAllMessage | -1 | All messages trigger notifications. |
| RCPushNotificationLevelDefault | 0 | Not set. This is the initial state when no setting is applied. Note: In this state, if neither the Ultra Group nor the group channel has settings, the default Do Not Disturb level for both is considered to notify all messages. |
| RCPushNotificationLevelMention | 1 | Only @ mentions trigger notifications, including @specific users and @all. |
| RCPushNotificationLevelMentionUsers | 2 | Only @specific user messages trigger notifications, and only the mentioned users receive notifications. Example: @张三 will trigger a notification for 张三, but @all will not trigger any notifications. |
| RCPushNotificationLevelMentionAll | 4 | Only @all messages trigger notifications, i.e., only @all notifications are received. |
| RCPushNotificationLevelBlocked | 5 | No notifications are received, even for @ mentions. |
SDK versions below 5.2.2 only support setting to Do Not Disturb state (no push notifications) or alert state (receive push notifications).
Managing Channel Do Not Disturb Settings
Ultra Groups support creating independent channels (channel) under Ultra Group conversations, aggregating message data (conversations, messages, unread counts) and group members by channel. The SDK allows users (userId) to set Do Not Disturb levels for specified group channels (channelId) in Ultra Group services.
Set Do Not Disturb Level for a Specified Channel (SDK ≥ 5.2.2)
This interface is available in the RCChannelClient class and is supported starting from version 5.2.2.
Set the Do Not Disturb level for messages in an Ultra Group channel for the current user.
Interface Prototype
- (void)setConversationChannelNotificationLevel:(RCConversationType)conversationType
targetId:(NSString *)targetId
channelId:(nullable NSString *)channelId
level:(RCPushNotificationLevel)level
success:(nullable void (^)(void))successBlock
error:(nullable void (^)(RCErrorCode status))errorBlock;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| conversationType | RCConversationType | Conversation type. |
| targetId | NSString | Conversation ID. |
| channelId | NSString | Ultra Group channel ID.
|
| level | RCPushNotificationLevel |
|
| successBlock | block | Callback interface |
| errorBlock | block | Callback interface |
Example Code
[[RCChannelClient sharedChannelManager] setConversationChannelNotificationLevel:"Conversation Type"
targetId:"Conversation Id"
channelId:"Channel Id"
level:RCPushNotificationLevelDefault
success:^() {}
error:^(RCErrorCode status) {
}];
Get Do Not Disturb Level for a Specified Channel (SDK ≥ 5.2.2)
Retrieve the Do Not Disturb level set for the current user in an Ultra Group channel.
Interface Prototype
- (void)getConversationChannelNotificationLevel:(RCConversationType)conversationType
targetId:(NSString *)targetId
channelId:(nullable NSString *)channelId
success:(nullable void (^)(RCPushNotificationLevel level))successBlock
error:(nullable void (^)(RCErrorCode status))errorBlock;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| conversationType | RCConversationType | Conversation type. |
| targetId | NSString | Conversation targetId. |
| channelId | NSString | Ultra Group channel ID. Retrieves the settings for the specified channel in the conversation. |
| successBlock | block | Callback interface |
| errorBlock | block | Callback interface |
Example Method
[[RCChannelClient sharedChannelManager] getConversationChannelNotificationLevel:"Conversation Type"
targetId:"Conversation Id"
channelId:"Channel Id"
success:^(RCPushNotificationLevel level) {}
error:^(RCErrorCode status) { }];