Skip to main content

Set Do Not Disturb by Channel

This document describes how to configure Do Not Disturb levels for specified channels (channelId) in Ultra Group services.

tip

The RC IM Client SDK supports multi-dimensional, multi-level Do Not Disturb settings:

  • You can configure Do Not Disturb functionality across multiple dimensions: App Key level, specific service segmentation (Ultra Group only), and user level. 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 contain 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 different types of @ mentions. Starting from SDK 5.2.2, channel-specific Do Not Disturb configurations support the following levels:

Enum ValueNumeric ValueDescription
PUSH_NOTIFICATION_LEVEL_ALL_MESSAGE-1All messages trigger notifications.
PUSH_NOTIFICATION_LEVEL_DEFAULT0Not set. This is the initial state when no configuration exists.

Note: In this state, if neither the Ultra Group nor its channels have configurations, the default Do Not Disturb level for both is considered to notify all messages.
PUSH_NOTIFICATION_LEVEL_MENTION1Only @ mention messages trigger notifications, including @ specific users and @ all members.
PUSH_NOTIFICATION_LEVEL_MENTION_USERS2Only @ specific user messages trigger notifications, and only the mentioned users receive notifications.

Example: @ Zhang San will trigger a notification for Zhang San; @ all members will not trigger notifications.
PUSH_NOTIFICATION_LEVEL_MENTION_ALL4Only @ all members messages trigger notifications, meaning only @ all member mentions will trigger push notifications.
PUSH_NOTIFICATION_LEVEL_BLOCKED5No notifications are received, even for @ mention messages.

SDK versions below 5.2.2 only support setting to Do Not Disturb state (no push notifications) or reminder 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) in Ultra Group services to set Do Not Disturb levels for specified group channels (channelId).

Set Channel Do Not Disturb Level (SDK ≥ 5.2.2)

tip

This interface is available in ChannelClient starting from version 5.2.2.

The current user sets the Do Not Disturb level for messages in an Ultra Group channel.

Interface

ChannelClient.getInstance().setConversationChannelNotificationLevel(conversationType,targetId,channelId,callback);

Parameter Description

ParameterTypeDescription
conversationTypeConversationTypeConversation type.
targetIdStringConversation ID
channelIdStringUltra Group channel ID.
  • If a channel ID is provided, the Do Not Disturb level is set for that specific channel. If no channel ID is specified, the setting applies to all Ultra Group messages.
  • Note: For customers who enabled Ultra Group services before 2022.09.01, if no channel ID is specified, an empty string "" should be passed, meaning the Do Not Disturb level will only apply to messages in the specified Ultra Group conversation (targetId) that do not belong to any channel. Submit a ticket if modifications are needed.
levPushNotificationLevel
  • -1: Notify all messages
  • 0: Not set (if unset by the user, the default setting of the group or APP level applies; if unset, all messages trigger notifications)
  • 1: Only notify @ mention messages
  • 2: Only notify @ specific user messages

    Example: @ Zhang San will trigger a notification for Zhang San; @ all members will not trigger notifications.

  • 4: Only notify @ all member messages, meaning only @ all member mentions trigger push notifications.
  • 5: No notifications
callbackOperationCallbackCallback interface.

Example Code

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";
String channelId = "Channel ID";

ChannelClient.getInstance().setConversationChannelNotificationLevel(conversationType,targetId,channelId,
IRongCoreEnum.PushNotificationLevel.PUSH_NOTIFICATION_LEVEL_DEFAULT,new IRongCoreCallback.OperationCallback() {
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess(notificationStatus);
}
}

@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
if (callback != null) {
callback.onError(coreErrorCode);
}
}
});

Get Channel Do Not Disturb Level (SDK ≥ 5.2.2)

Retrieve the Do Not Disturb level set by the current user for an Ultra Group channel.

Interface

ChannelClient.getInstance().getConversationChannelNotificationLevel(conversationType,targetId,channelId,callback);

Parameter Description

ParameterTypeDescription
conversationType[ConversationType]Conversation type
targetIdStringConversation ID
channelIdStringUltra Group channel ID, retrieves settings for the specified channel.
callbackResultCallback<IRongCoreEnum.PushNotificationLevel>Callback interface

Example Code

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";
String channelId = "Channel ID";

ChannelClient.getInstance().getConversationChannelNotificationLevel(conversationType,targetId,channelId,new IRongCoreCallback.ResultCallback<
IRongCoreEnum.PushNotificationLevel>() {
@Override
public void onSuccess(IRongCoreEnum.PushNotificationLevel level) {

}

@Override
public void onError(IRongCoreEnum.CoreErrorCode e) {

}
});

Multi-Device Do Not Disturb Status Synchronization

The SDK provides a conversation status (pinned or Do Not Disturb) synchronization mechanism. By setting a conversation status synchronization listener, changes made to conversation status on other devices can be monitored in real-time on the current device. For details, see Multi-Device Do Not Disturb/Pin Synchronization.