Do Not Disturb Feature Overview
The "Do Not Disturb" feature controls whether users can receive push notifications for offline messages when their client devices are offline.
- Client is offline: When there are new offline messages in a conversation, users will receive the messages through the push channel by default, and a notification will pop up. After enabling Do Not Disturb, RC's server will not trigger push notifications for related messages.
- Client is running in the background: When there are new messages in a conversation, users will receive the messages directly. If you are using IMLib, you need to determine whether the app is running in the background and implement the local notification pop-up based on your business requirements.
Prerequisites
Please ensure that APNs push integration is completed before using the "Do Not Disturb" feature.
Dimensions of Do Not Disturb Settings
The client SDK supports multiple dimensions of Do Not Disturb settings for one-to-one chat, group chat, and system conversation:
- App-level Do Not Disturb settings
- Do Not Disturb level by conversation type
- Do Not Disturb level by conversation
- Global Do Not Disturb
App-level Do Not Disturb Settings
Set the default Do Not Disturb level for all users of the entire app based on the App Key. By default, it is not set, which means all messages will trigger notifications. This level of configuration is not yet available in the Console. If needed, please submit a ticket.
- Notify all messages: Users in the current app can receive push notifications for any message.
- Not set: By default, all messages will trigger notifications.
- Notify only @ messages: Users in the current app will only receive push notifications for messages that mention (@) them or all group members.
- Notify only @ specific users: Users in the current app will only receive push notifications for messages that mention (@) them. For example, only Zhang San will receive notifications for messages like "@Zhang San Hello".
- Notify only @ all group members: Users in the current app will only receive push notifications for messages that mention (@) all group members.
- Do not notify any messages: Users in the current app will not receive push notifications for any messages, meaning no offline messages will trigger push notifications.
- Do not send push notifications for group chat messages except @ messages: Users in the current app will receive push notifications for one-to-one chat messages, messages that mention (@) them, and messages that mention (@) all group members.
When RC's server determines whether to send a push notification, the app-level Do Not Disturb configuration has the lowest priority. If any of the following user-level Do Not Disturb configurations exist, the user-level configuration will take precedence:
- Do Not Disturb level by conversation type
- Do Not Disturb level by conversation
- Global Do Not Disturb
Do Not Disturb Level by Conversation Type
The client SDK has supported this feature since version 5.2.2.1. This feature belongs to user-level settings.
The client SDK provides RCPushNotificationLevel
, allowing users to configure the message categories that trigger push notifications for conversation types (one-to-one chat, group chat, ultra group, system conversation) or completely disable notifications. The following six levels are provided:
Enumeration Value | Numeric Value | Description |
---|---|---|
RCPushNotificationLevelAllMessage | -1 | After disconnecting from RC's server, the current user can receive notifications for all messages in the specified conversation type. |
RCPushNotificationLevelDefault | 0 | Not set. This is the initial state when not set. |
RCPushNotificationLevelMention | 1 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation type that mention (@) them or all group members. |
RCPushNotificationLevelMentionUsers | 2 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation type that mention (@) them. For example, Zhang San will only receive notifications for messages like "@Zhang San Hello". |
RCPushNotificationLevelMentionAll | 4 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation type that mention (@) all group members. |
RCPushNotificationLevelBlocked | 5 | The current user will not receive push notifications for any messages in the specified conversation type. |
For specific setup methods, see Do Not Disturb by Conversation Type.
When RC's server determines whether to send a push notification to the user, if any of the following user-level Do Not Disturb configurations exist, the following configurations will take precedence:
- Do Not Disturb level by conversation
- Global Do Not Disturb
Do Not Disturb Level by Conversation
The client SDK has supported this feature since version 5.2.2. This feature belongs to user-level settings.
The client SDK provides RCPushNotificationLevel
, allowing users to configure the message categories that trigger notifications for a conversation or completely disable notifications. The following six levels are provided:
Enumeration Value | Numeric Value | Description |
---|---|---|
RCPushNotificationLevelAllMessage | -1 | After disconnecting from RC's server, the current user can receive notifications for all messages in the specified conversation. |
RCPushNotificationLevelDefault | 0 | Not set. This is the initial state when not set. |
RCPushNotificationLevelMention | 1 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation that mention (@) them or all group members. |
RCPushNotificationLevelMentionUsers | 2 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation that mention (@) them. For example, Zhang San will only receive notifications for messages like "@Zhang San Hello". |
RCPushNotificationLevelMentionAll | 4 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation that mention (@) all group members. |
RCPushNotificationLevelBlocked | 5 | The current user will not receive push notifications for any messages in the specified conversation. |
For specific setup methods, see Do Not Disturb by Conversation.
When RC's server determines whether to send a push notification to the user, if the user has configured Global Do Not Disturb, the Global Do Not Disturb configuration details will take precedence.
Global Do Not Disturb
The client SDK has provided RCPushNotificationQuietHoursLevel
since version 5.2.2, allowing users to configure when to receive notifications and the message categories that trigger notifications. The following three levels are provided:
Enumeration Value | Numeric Value | Description |
---|---|---|
RCPushNotificationQuietHoursLevelDefault | 0 | Not set. If not set, the SDK will query the user-level Do Not Disturb settings for the message's group and other non-user-level settings to determine whether to send a push notification. |
RCPushNotificationQuietHoursLevelMention | 1 | After disconnecting from RC's server, the current user will only receive notifications for messages in the specified conversation that mention (@) them or all group members during the specified period. |
RCPushNotificationQuietHoursLevelBlocked | 5 | The current user will not receive push notifications for any messages during the specified period. |
For specific setup methods, see Global Do Not Disturb.
SDK versions earlier than 5.2.2 do not support setting the message categories that trigger notifications; they only support enabling or disabling push notifications.
Priority of Do Not Disturb Settings
For one-to-one chat, group chat, and system conversation, RC's server will follow the order below to search for Do Not Disturb configurations. The priority decreases from left to right, and the configuration with the highest priority will be used to determine whether to trigger a push notification:
Global Do Not Disturb settings (user-level) > Do Not Disturb settings by conversation type (user-level) > Do Not Disturb settings by conversation (user-level) > App-level Do Not Disturb settings
API Interface List
The table below describes the API interfaces for Do Not Disturb configurations applicable to one-to-one chat, group chat, and system conversation.
Do Not Disturb Configuration Dimension | Client API | Server API |
---|---|---|
Set the global Do Not Disturb level for the app during a specified period. | See Global Do Not Disturb. | See Set User Do Not Disturb Period. |
Set the Do Not Disturb level by conversation type | See Do Not Disturb by Conversation Type. | See Set Do Not Disturb by Conversation Type. |
Set the Do Not Disturb level by conversation | See Do Not Disturb by Conversation. | See Set Do Not Disturb by Conversation. |
Set the app-level Do Not Disturb level | The client SDK does not provide an API. | The server does not provide this API. |