Set Do Not Disturb by Conversation Type
This article describes how to set the Do Not Disturb level for a specified conversation type (conversationType
).
The Instant Messaging client SDK supports multi-dimensional, multi-level Do Not Disturb settings.
- App developers can implement Do Not Disturb configurations at multiple levels: App Key, specific business segments (ultra groups only), and user level. When the RC server decides whether to trigger a push notification, the priority of different levels is as follows: User-level settings > Default configuration for specified ultra group channels (ultra groups only) > Default configuration for specified ultra group conversations (ultra groups only) > App Key-level settings.
- User-level settings include multiple dimensions. When the RC server decides whether to trigger a push notification, if user-level configurations exist, the priority of different 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 Overview.
When Do Not Disturb is active, the client behaves as follows upon receiving new messages:
- Client running in the background: When there is a new message in the conversation, the message content can be received. You need to implement the local notification popup yourself.
- Client offline: When there is a new message in the conversation, no remote notification will be received, but the message content can be retrieved upon reconnection.
Supported Do Not Disturb Levels
The Do Not Disturb level provides control over different @ message notifications. Starting from SDK version 5.2.2.1, the Do Not Disturb configuration for specified conversation types supports the following levels:
Enum Value | Value | Description |
---|---|---|
RCPushNotificationLevelAllMessage | -1 | Notify for all messages. |
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 for all messages. |
RCPushNotificationLevelMention | 1 | Notify only for @ messages, including @ specific users and @ all. |
RCPushNotificationLevelMentionUsers | 2 | Notify only for @ specific user messages, and only notify the specified user who is @ mentioned. For example: @张三, then 张三 can receive the push; @ all will not trigger a push notification. |
RCPushNotificationLevelMentionAll | 4 | Notify only for @ 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.1 only support setting to Do Not Disturb state (no push notifications) or alert state (receive push notifications).
Managing Do Not Disturb Levels by Conversation Type
Starting from SDK version 5.2.2.1, the Instant Messaging service supports users (userId
) setting Do Not Disturb levels for specified conversation types (conversationType
), including one-to-one chat, group chat, and ultra group conversations.
Set Do Not Disturb Level for Specified Conversation Type
This interface is in RCChannelClient
and is supported starting from version 5.2.2.1.
Set the Do Not Disturb level for a specified conversation type (conversationType
) for the user, supporting one-to-one chat, group chat, and ultra group conversations.
[[RCChannelClient sharedChannelManager] setConversationTypeNotificationLevel:"Conversation Type"
level:RCPushNotificationLevelDefault
success:^() {}
error:^(RCErrorCode status) {}];
Parameter | Type | Description |
---|---|---|
conversationType | RCConversationType | Conversation type. Chatroom type is not supported because chatrooms do not accept message reminders by default. |
level | RCPushNotificationLevel |
|
successBlock | block | Callback interface |
errorBlock | block | Callback interface |
Remove Do Not Disturb Level for Specified Conversation Type
To remove the Do Not Disturb level setting for a specified conversation type, call the set interface and pass RCPushNotificationLevelDefault
to the level
parameter.
Query Do Not Disturb Level for Specified Conversation Type
This interface is in RCChannelClient
and is supported starting from version 5.2.2.1.
Query the Do Not Disturb level set by the current user for a specified conversation type (conversationType
).
[[RCChannelClient sharedChannelManager] getConversationTypeNotificationLevel:"Conversation Type"
success:^(RCPushNotificationLevel level) {}
error:^(RCErrorCode status) {}];
Parameter | Type | Description |
---|---|---|
conversationType | RCConversationType | Conversation type. Chatroom type is not supported because chatrooms do not accept message reminders by default. |
level | RCPushNotificationLevel |
|
successBlock | block | Callback interface |
errorBlock | block | Callback interface |