Setting Default Do Not Disturb for Groups/Channels
Ultra groups support setting default Do Not Disturb rules for specified ultra groups or group channels. These default rules apply to all group members and are typically configured by ultra group administrators.
If you wish to control the default Do Not Disturb settings for specific ultra groups or channels from your application server, refer to the server API documentation Set Default Do Not Disturb for Ultra Groups/Channels.
Important Notes
-
When RC's server determines whether to push ultra group messages, the default Do Not Disturb configurations for specified ultra groups or channels have lower priority than user-level configurations. If any user-level Do Not Disturb settings exist, they take precedence.
tipThe user-level settings for IM service's Do Not Disturb feature allow controlling Do Not Disturb levels for specific one-to-one chats, group chats, ultra group conversations, and ultra group channels, including setting global Do Not Disturb time periods and levels. The priority of user-level settings is as follows: Global Do Not Disturb > Channel-specific Do Not Disturb > Conversation-specific Do Not Disturb > Conversation-type-specific Do Not Disturb. See Ultra Group Do Not Disturb Overview for details.
-
Default Do Not Disturb rules set for an ultra group automatically apply to all its channels. If a channel has its own default Do Not Disturb setting, that channel-specific setting takes precedence.
Supported Do Not Disturb Levels
The default Do Not Disturb level for an ultra group or channel can be set to any of the following:
| Enum Value | Numeric Value | Description |
|---|---|---|
| RCPushNotificationLevelAllMessage | -1 | Notify for all messages. |
| RCPushNotificationLevelDefault | 0 | Not set. This is the initial state when no setting is configured. Note: In this state, if neither the ultra group nor its channels have settings, the default behavior is to notify for all messages. |
| RCPushNotificationLevelMention | 1 | Only notify for @mentions, including @specific users and @all. |
| RCPushNotificationLevelMentionUsers | 2 | Only notify for @specific user mentions, and only notify the mentioned users. Example: @John will notify John; @all will not trigger notifications. |
| RCPushNotificationLevelMentionAll | 4 | Only notify for @all mentions, meaning only @all messages trigger notifications. |
| RCPushNotificationLevelBlocked | 5 | Block all notifications, including @mentions. |
typedef NS_ENUM(NSInteger, RCPushNotificationLevel) {
/*!
Notify for all messages (explicitly disable Do Not Disturb)
*/
RCPushNotificationLevelAllMessage = -1,
/*!
Not set (fall back to group or app-level settings), legacy data uses 0 for unset
*/
RCPushNotificationLevelDefault = 0,
/*!
For group chats/ultra groups: notify when @all or @mentioning self; for one-to-one chats: no notification
*/
RCPushNotificationLevelMention = 1,
/*!
For group chats/ultra groups: notify when @mentioning self (not @all); for one-to-one chats: no notification
*/
RCPushNotificationLevelMentionUsers = 2,
/*!
For group chats/ultra groups: notify only for @all; for one-to-one chats: no notification
*/
RCPushNotificationLevelMentionAll = 4,
/*!
Block all message notifications
*/
RCPushNotificationLevelBlocked = 5,
};
Set Default Do Not Disturb Level for an Ultra Group
Method Signature
- (void)setUltraGroupConversationDefaultNotificationLevel:(NSString *)targetId
level:(RCPushNotificationLevel)level
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode status))errorBlock;
Parameters
| Parameter | Type | Description |
|---|---|---|
| targetId | NSString | Ultra group conversation targetId. |
| level | RCPushNotificationLevel | Do Not Disturb level. |
| successBlock | Block | Success callback. |
| errorBlock | Block | Failure callback. status contains the error code RCErrorCode. |
Example Code
[[RCChannelClient sharedChannelManager] setUltraGroupConversationDefaultNotificationLevel:@"targetId"
level:level
success:^{
} error:^(RCErrorCode status) {
}];
Query Default Do Not Disturb Level for an Ultra Group
Method Signature
- (void)getUltraGroupConversationDefaultNotificationLevel:(NSString *)targetId
success:(void (^)(RCPushNotificationLevel level))successBlock
error:(void (^)(RCErrorCode status))errorBlock;
Parameters
| Parameter | Type | Description |
|---|---|---|
| targetId | NSString | Ultra group conversation targetId. |
| successBlock | Block | Success callback containing the Do Not Disturb level RCPushNotificationLevel. |
| errorBlock | Block | Failure callback. status contains the error code RCErrorCode. |
Example Code
[[RCChannelClient sharedChannelManager] getUltraGroupConversationDefaultNotificationLevel:@"targetId"
success:^(RCPushNotificationLevel level) {
} error:^(RCErrorCode status) {
}];
Set Default Do Not Disturb Level for a Group Channel
Method Signature
- (void)setUltraGroupConversationChannelDefaultNotificationLevel:(NSString *)targetId
channelId:(NSString *)channelId
level:(RCPushNotificationLevel)level
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode status))errorBlock;
Parameters
| Parameter | Type | Description |
|---|---|---|
| targetId | NSString | Ultra group conversation targetId. |
| channelId | NSString | Ultra group channel channelId. |
| level | RCPushNotificationLevel | Do Not Disturb level. |
| successBlock | Block | Success callback. |
| errorBlock | Block | Failure callback. status contains the error code RCErrorCode. |
Example Code
[[RCChannelClient sharedChannelManager] setUltraGroupConversationChannelDefaultNotificationLevel:@"targetId"
channelId:@"channelId"
level:level
success:^{
} error:^(RCErrorCode status) {
}];
Query Default Do Not Disturb Level for a Group Channel
Method Signature
- (void)getUltraGroupConversationChannelDefaultNotificationLevel:(NSString *)targetId
channelId:(NSString *)channelId
success:(void (^)(RCPushNotificationLevel level))successBlock
error:(void (^)(RCErrorCode status))errorBlock;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| targetId | NSString | Target ID of the ultra group conversation. |
| channelId | NSString | Channel ID of the ultra group. |
| successBlock | Block | Success callback containing the corresponding Do Not Disturb level RCPushNotificationLevel. |
| errorBlock | Block | Failure callback. status contains the error code RCErrorCode. |
Example Code
[[RCChannelClient sharedChannelManager] getUltraGroupConversationChannelDefaultNotificationLevel:@"targetId"
channelId:@"channelId"
success:^(RCPushNotificationLevel level) {
} error:^(RCErrorCode status) {
}];