Muting Channels

Muting a channel prevents it from triggering push notifications, unhiding, or incrementing the unread count for that user.

By default, mutes remain active indefinitely until removed. You can optionally set an expiration time. The list of muted channels and their expiration times is returned when the user connects.

Mute a Channel

require 'getstream_ruby'

Models = GetStream::Generated::Models

client.chat.mute_channel(Models::MuteChannelRequest.new(
  channel_cids: ['messaging:general'],
  user_id: 'john'
))

# With expiration (in milliseconds)
client.chat.mute_channel(Models::MuteChannelRequest.new(
  channel_cids: ['messaging:general'],
  user_id: 'john',
  expiration: 1000
))
Info:

Messages added to muted channels do not increase the unread messages count.

Query Muted Channels

Muted channels can be filtered or excluded by using the muted in your query channels filter.

require 'getstream_ruby'

Models = GetStream::Generated::Models

client.chat.query_channels(Models::QueryChannelsRequest.new(
  filter_conditions: { 'muted' => true }
))

Remove a Channel Mute

Use the unmute method to restore normal notifications and unread behavior for a channel.

require 'getstream_ruby'

Models = GetStream::Generated::Models

client.chat.unmute_channel(Models::UnmuteChannelRequest.new(
  channel_cids: ['messaging:general'],
  user_id: 'john'
))
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Chat Ruby: <Your Question>