DND settings by channel
Set the Do Not Disturb (DND) level for a specific channel. Supported channel types: Direct Channel, Group channel, Community channel.
The Chat SDK supports multi-dimensional, multi-level DND configuration. Under user-level settings, the priority order is: Global DND > DND by channel ID (Community channel sub-channel) > DND by channel > DND by channel type. See DND Overview.
Supported DND levels
| Enum value | Numeric value | Description |
|---|---|---|
NCChannelNoDisturbLevelAllMessage | -1 | Notify for all messages. |
NCChannelNoDisturbLevelDefaultLevel | 0 | Not set — inherits from channel-type or app-level settings. |
NCChannelNoDisturbLevelMention | 1 | Notify only for @mention messages (@user and @everyone). |
NCChannelNoDisturbLevelMentionUsers | 2 | Notify only when the current user is specifically @mentioned. |
NCChannelNoDisturbLevelMentionAll | 4 | Notify only for @everyone messages. |
NCChannelNoDisturbLevelMuted | 5 | Suppress all notifications, including mentions. |
Set the DND level for a channel
Get the channel instance and call setNoDisturbLevel:completion::
- Swift
- Objective-C
import NexconnChatSDK
// Direct Channel example
let channel = DirectChannel(channelId: "targetUserId")
channel setNoDisturbLevel:NCChannelNoDisturbLevelMuted
completion:^(NCError *error) {
if (error == nil) {
// NSLog("DND level set.")
} else {
// NSLog("Failed: %", error)
}
}
// Direct Channel example
NCDirectChannel *channel = [[NCDirectChannel alloc] initWithChannelId:@"targetUserId"];
[channel setNoDisturbLevel:NCChannelNoDisturbLevelMuted
completion:^(NCError *error) {
if (error == nil) {
NSLog(@"DND level set.");
} else {
NSLog(@"Failed: %@", error);
}
}];
- Swift
- Objective-C
import NexconnChatSDK
// Group channel example
let channel = GroupChannel(channelId: "groupId")
channel setNoDisturbLevel:NCChannelNoDisturbLevelMention
completion:^(NCError *error) {
if (error == nil) {
// NSLog("DND level set.")
}
}
// Group channel example
NCGroupChannel *channel = [[NCGroupChannel alloc] initWithChannelId:@"groupId"];
[channel setNoDisturbLevel:NCChannelNoDisturbLevelMention
completion:^(NCError *error) {
if (error == nil) {
NSLog(@"DND level set.");
}
}];
Remove the DND level for a channel
Pass NCChannelNoDisturbLevelDefaultLevel to reset to the default (inherits from channel type or app level):
- Swift
- Objective-C
import NexconnChatSDK
channel setNoDisturbLevel:NCChannelNoDisturbLevelDefaultLevel
completion:^(NCError *error) {}]
[channel setNoDisturbLevel:NCChannelNoDisturbLevelDefaultLevel
completion:^(NCError *error) {}];
Sync DND status across devices
The SDK provides a channel-status synchronization mechanism. Register an NCChannelHandler to receive real-time updates when the DND level is changed on another device. See Sync Channel Status Across Devices.