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 local notification pop-ups based on your business requirements.
Prerequisites
Before using the Do Not Disturb feature, ensure that third-party push notifications are integrated and that push services are enabled for users.
Dimensions of Do Not Disturb Settings
The client SDK supports Do Not Disturb settings for one-to-one chat, group chat, and system conversations across multiple dimensions:
- 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 application based on the App Key. By default, no settings are configured, which is equivalent to receiving notifications for all messages. This level of configuration is not currently available in the Console. If needed, please submit a ticket.
- Notify all messages: Users under the current app can receive push notifications for any message.
- Not set: By default, all messages are notified.
- Notify only @ mentions: Under the current app, push notifications are sent to offline users only for messages that mention (@) a specific user or all group members.
- Notify only @ specific user: Under the current app, users will receive push notifications only for messages that mention (@) the current user. For example, only Zhang San will receive and only receive notifications for messages like "@Zhang San Hello."
- Notify only @ all group members: Under the current app, users will receive push notifications only for messages that mention (@) all group members.
- Do not notify any messages: Under the current app, users will not receive push notifications for any messages, meaning no push notifications will be triggered for any offline messages.
- Do not send push notifications for group chat messages except @ mentions: Under the current app, users will receive push notifications for one-to-one chat messages, messages that mention (@) a specific user, and messages that mention (@) all group members.
When determining whether to send a push notification, RC's server gives the lowest priority to the app-level Do Not Disturb configuration. If any of the following user-level Do Not Disturb configurations exist, the user-level configuration takes 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
This feature is a user-level setting.
The client SDK's Do Not Disturb level configuration is defined in the RCIMIWPushNotificationLevel
enumeration class, allowing users to configure the types of messages that trigger push notifications for conversation types (one-to-one chat, group chat, ultra group, system conversation) or to completely turn off notifications. The following six levels are provided:
Enum | Description |
---|---|
allMessage | After disconnecting from RC's server, the current user can receive notifications for all messages in the specified type of conversation. |
none | Not set. This is the initial state when no settings are configured. |
mention | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified type of conversation that mention (@) the current user and all group members. |
mentionUsers | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified type of conversation that mention (@) the current user. For example, Zhang San will only receive notifications for messages like "@Zhang San Hello." |
mentionAll | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified type of conversation that mention (@) all group members. |
blocked | The current user will not receive push notifications for any messages in the specified type of conversation. |
For specific setup methods, see Do Not Disturb by Conversation Type.
When determining whether to send push notifications to a user, if any of the following user-level Do Not Disturb configurations exist, the following configurations take precedence:
- Do Not Disturb level by conversation
- Global Do Not Disturb
Do Not Disturb Level by Conversation
This feature is a user-level setting.
The client SDK provides RCIMIWPushNotificationLevel
, allowing users to configure the types of messages that trigger notifications for a conversation or to completely turn off notifications. The following six levels are provided:
Enum | Description |
---|---|
allMessage | After disconnecting from RC's server, the current user can receive notifications for all messages in the specified type of conversation. |
none | Not set. This is the initial state when no settings are configured. |
mention | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified type of conversation that mention (@) the current user and all group members. |
mentionUsers | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified type of conversation that mention (@) the current user. For example, Zhang San will only receive notifications for messages like "@Zhang San Hello." |
mentionAll | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified type of conversation that mention (@) all group members. |
blocked | The current user will not receive push notifications for any messages in the specified type of conversation. |
For specific setup methods, see Do Not Disturb by Conversation.
When determining whether to send push notifications to a user, if the user has configured Global Do Not Disturb, the Global Do Not Disturb configuration details take precedence.
Global Do Not Disturb
The client SDK provides RCIMIWPushNotificationQuietHoursLevel
, allowing users to configure when to receive notifications and the types of messages that trigger notifications. The following three levels are provided:
Enum | Description |
---|---|
none | 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. |
mentionMessage | After disconnecting from RC's server, the current user will receive notifications only for messages in the specified conversation that mention (@) the current user and all group members during the specified period. |
blocked | The current user will not receive push notifications for any messages during the specified period. |
For specific setup methods, see Global Do Not Disturb.
Priority of Do Not Disturb Settings
For one-to-one chat, group chat, and system conversations, 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 is 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 configuring Do Not Disturb for one-to-one chat, group chat, and system conversations.
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 App-level Do Not Disturb level | The client SDK does not provide an API. | The server does not provide this API. |