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

channel := client.Chat().Channel("messaging", "general")

channel.UpdateChannelPartial(ctx, &getstream.UpdateChannelPartialRequest{
	Set: map[string]any{"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.

resp, err := client.Chat().GetChannelType(ctx, "messaging", &getstream.GetChannelTypeRequest{})
adminGrants := append(resp.Data.Grants["admin"], "use-frozen-channel")

client.Chat().UpdateChannelType(ctx, "messaging", &getstream.UpdateChannelTypeRequest{
	Automod:          resp.Data.Automod,
	AutomodBehavior:  resp.Data.AutomodBehavior,
	MaxMessageLength: resp.Data.MaxMessageLength,
	Grants:           map[string][]string{"admin": adminGrants},
})