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.
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 Value | Value | Description |
---|---|---|
RCPushNotificationLevelAllMessage | -1 | All messages can be notified. |
RCPushNotificationLevelDefault | 0 | Not 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. |
RCPushNotificationLevelMention | 1 | Only notify @ messages, including @specific users and @all. |
RCPushNotificationLevelMentionUsers | 2 | Only 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. |
RCPushNotificationLevelMentionAll | 4 | Only notify @all messages, i.e., only receive push notifications for @all. |
RCPushNotificationLevelBlocked | 5 | Do 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)
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) {}];
Parameter | Type | Description |
---|---|---|
conversationType | RCConversationType | Conversation type. |
targetId | NSString | Conversation ID |
channelId | NSString | The channel ID of the Ultra Group conversation.
|
level | RCPushNotificationLevel |
|
successBlock | block | Callback interface |
errorBlock | block | Callback 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) { }];
Parameter | Type | Description |
---|---|---|
conversationType | RCConversationType | Conversation type |
targetId | NSString | Conversation ID |
channelId | NSString | The channel ID of the Ultra Group conversation, get the setting for the specified channel of the conversation. |
successBlock | block | Callback interface |
errorBlock | block | Callback interface |