Skip to main content

Do not disturb by channel ID

Set the Do Not Disturb (DND) level for a specific sub-channel within a Community channel.

tip

Within user-level DND settings, the priority order is: Global DND > DND by channel ID > DND by channel > DND by channel type. See DND Overview.

Supported DND levels

Enum valueNumeric valueDescription
NCChannelNoDisturbLevelAllMessage-1Notify for all messages.
NCChannelNoDisturbLevelDefaultLevel0Not set — inherits from channel or app-level settings.
NCChannelNoDisturbLevelMention1Notify only for @mention messages (@user and @everyone).
NCChannelNoDisturbLevelMentionUsers2Notify only when the current user is specifically @mentioned.
NCChannelNoDisturbLevelMentionAll4Notify only for @everyone messages.
NCChannelNoDisturbLevelMuted5Suppress all notifications, including mentions.

Set DND for a community channel sub-channel

Create an NCCommunitySubChannelIdentifier with the Community channel ID and sub-channel ID, then instantiate the channel and set the DND level:

swift
import NexconnChatSDK

guard let subChannel = CommunitySubChannel(
channelId: "communityId",
subChannelId: "subChannelId"
) else {
return
}

subChannel.setNoDisturbLevel(.muted) { error in
if error == nil {
print("Sub-channel DND set.")
} else {
print("Failed: \(error!)")
}
}

Remove the DND level

Pass NCChannelNoDisturbLevelDefaultLevel to reset to the default:

swift
import NexconnChatSDK

subChannel.setNoDisturbLevel(.defaultLevel) { error in
// DND level removed
}