Freezing Channels

Freezing a channel prevents users from sending new messages and adding or deleting reactions.

Sending a message to a frozen channel returns an error message. Attempting to add or delete reactions returns a 403 Not Allowed error.

User roles with the UseFrozenChannel permission can still use frozen channels normally. By default, no user role has this permission.

Freeze a Channel

require 'getstream_ruby'

Models = GetStream::Generated::Models

client.chat.update_channel_partial("messaging", "general", Models::UpdateChannelPartialRequest.new(
  set: { 'frozen' => true }
))

Unfreeze a Channel

Granting the Frozen Channel Permission

Permissions are typically managed in the Stream Dashboard under your app's Roles & Permissions settings. This is the recommended approach for most use cases.

To grant permissions programmatically, update the channel type using a server-side API call. See user permissions for more details.

require 'getstream_ruby'

Models = GetStream::Generated::Models

resp = client.chat.get_channel_type("messaging")

admin_grants = resp.grants['admin'] + ['use-frozen-channel']

client.chat.update_channel_type("messaging", Models::UpdateChannelTypeRequest.new(
  automod: resp.automod,
  automod_behavior: resp.automod_behavior,
  max_message_length: resp.max_message_length,
  grants: { 'admin' => admin_grants }
))