Archiving Channels

Channel members can archive a channel for themselves. This is a per-user setting that does not affect other members.

Archived channels function identically to regular channels via the API, but your UI can display them separately. When a channel is archived, the timestamp is recorded and returned as archived_at in the response.

When querying channels, filter by archived: true to retrieve only archived channels, or archived: false to exclude them.

Archive a Channel

// Retrieve ChannelClient
val channelClient = client.channel("messaging", "example")

// Archive the channel
channelClient.archive().enqueue { /* ... */ }

// Query for channels that are archived
val query = QueryChannelsRequest(
  filter = Filters.eq("archived", true),
  offset = 0,
  limit = 10,
)
client.queryChannels(query).enqueue { /* ... */ }

// Unarchive the channel
channelClient.unarchive().enqueue { /* ... */ }

Global Archiving

To archive a channel for all users, use filter_tags to tag the channel as archived. This allows you to query for globally archived channels across your application.

// Archive globally by adding an "archived" tag
val channelClient = client.channel("messaging", "general")
channelClient.update(message = null, extraData = mapOf("filter_tags" to listOf("archived"))).enqueue { /* ... */ }

// Query globally archived channels
val filter = Filters.`in`("filter_tags", listOf("archived"))
val request = QueryChannelsRequest(filter = filter, limit = 30)
client.queryChannels(request).enqueue { /* ... */ }