Hiding Channels

Hiding a channel removes it from query channel requests for that user until a new message is added. Only channel members can hide a channel.

Hidden channels may still have unread messages. Consider marking the channel as read before hiding it.

You can optionally clear the message history for that user when hiding. When a new message is received, it will be the only message visible to that user.

Hide a Channel

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

// hides the channel until a new message is added there
channel.Hide(ctx, &getstream.HideChannelRequest{
	UserID: getstream.PtrTo("john"),
})

// shows a previously hidden channel
channel.Show(ctx, &getstream.ShowChannelRequest{
	UserID: getstream.PtrTo("john"),
})

// hide the channel and clear the message history
channel.Hide(ctx, &getstream.HideChannelRequest{
	UserID:       getstream.PtrTo("john"),
	ClearHistory: getstream.PtrTo(true),
})
Info:

You can still retrieve the list of hidden channels using the { "hidden" : true } query parameter.

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 Go: <Your Question>