Skip to main content

Tagging group channels

The channel tagging feature for group channels works the same as for direct channels. See Tagging Channels for the full API reference.

All tag operations apply to group channels in the same way they apply to direct channels. This includes adding channels to tags, removing channels from tags, removing tags from channels, getting tags for a channel, querying channels by tag with pagination, getting unread counts by tag, clearing unread counts, and deleting channels by tag.

For group-specific examples, replace DirectChannel with GroupChannel and ChannelType.DIRECT with ChannelType.GROUP.

Example: Add group channels to a tag

kotlin
Tag.getTags { tagList, error ->
if (error == null && tagList != null) {
val tag = tagList.firstOrNull { it.tagId == "myTag" }

if (tag != null) {
tag.addChannels(
listOf(
ChannelIdentifier(ChannelType.GROUP, "groupId1"),
ChannelIdentifier(ChannelType.GROUP, "groupId2")
)
) { error ->
if (error == null) {
// Added successfully
}
}
}
}
}

For the complete tagging API reference, see Tagging Channels.