Overview of Do Not Disturb Feature
The "Do Not Disturb" feature controls whether users can receive push notifications for offline messages when their client device is offline.
- Client is offline: When there are new offline messages in a conversation, users will receive notifications via the push channel by default. 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 using IMLib, you need to determine whether the app is running in the background and implement local notification pop-ups based on 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 multiple dimensions of Do Not Disturb settings for one-to-one chat, group chat, and system conversations:
- 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 app based on the App Key. By default, no setting is applied, which is equivalent to receiving notifications for all messages. This level of configuration is not yet 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 @ messages: Under the current app, push notifications are sent to offline users only for messages that mention (@) the specified user or all group members.
- Notify only @ specified user: Under the current app, users receive push notifications only for messages that mention (@) the current user. For example, only Zhang San will receive notifications for messages like "@Zhang San Hello".
- Notify only @ all group members: Under the current app, users receive push notifications only for messages that mention (@) all group members.
- Do not notify any messages: Under the current app, users do not receive push notifications for any messages, meaning no offline messages will trigger push notifications.
- Do not notify group chat messages except @ messages: Under the current app, users receive push notifications for one-to-one chat messages, messages that mention (@) the specified user, and messages that mention (@) all group members.
When RC's server determines whether to push notifications, 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 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 belongs to user-level settings.
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 completely disable notifications. The following six levels are provided:
Enum | Description |
---|---|
ALL_MESSAGE | After disconnecting from the RC server, the current user can receive notifications for all messages in the specified conversation type. |
NONE | Not set. This is the initial state when no setting is applied. |
MENTION | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) the current user and all group members in the specified conversation type. |
MENTION_USERS | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) the current user in the specified conversation type. For example, Zhang San will only receive notifications for messages like "@Zhang San Hello". |
MENTION_ALL | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) all group members in the specified conversation type. |
BLOCKED | The current user does 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 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 belongs to user-level settings.
The client SDK provides RCIMIWPushNotificationLevel, allowing users to configure the types of messages that trigger notifications for a conversation or completely disable notifications. The following six levels are provided:
Enum | Description |
---|---|
ALL_MESSAGE | After disconnecting from the RC server, the current user can receive notifications for all messages in the specified conversation. |
NONE | Not set. This is the initial state when no setting is applied. |
MENTION | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) the current user and all group members in the specified conversation. |
MENTION_USERS | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) the current user in the specified conversation. For example, Zhang San will only receive notifications for messages like "@Zhang San Hello". |
MENTION_ALL | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) all group members in the specified conversation. |
BLOCKED | The current user does 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 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 of the message's group and other non-user-level settings in sequence to determine whether to push notifications. |
MENTION_MESSAGE | After disconnecting from the RC server, the current user receives notifications only for messages that mention (@) the current user and all group members in the specified conversation during the specified period. |
BLOCKED | The current user does 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, the RC 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 push notifications:
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 applicable to Do Not Disturb configurations for one-to-one chat, group chat, and system conversations.
Do Not Disturb Configuration Dimension | Client API | Server API |
---|---|---|
Set the app-level Do Not Disturb level for 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. |