Updating a Channel

There are two ways to update a channel with the Stream API: partial updates and full updates. A partial update preserves existing custom key–value data, while a full update replaces the entire channel object and removes any fields not included in the request.

Partial Update

A partial update lets you set or unset specific fields without affecting the rest of the channel’s custom data — essentially a patch-style update.

public async Task PartialUpdate()
{
  var channel = await Client.GetOrCreateChannelWithIdAsync(ChannelType.Messaging, channelId: "my-channel-id");

  var setClanInfo = new ClanData
  {
    MaxMembers = 50,
    Name = "Wild Boards",
    Tags = new List<string>
    {
      "Competitive",
      "Legendary",
    }
  };

  var setFields = new Dictionary<string, object>();

  // Set custom values
  setFields.Add("frags", 5);
  // Set custom arrays
  setFields.Add("items", new[] { "sword", "shield" });
  // Set custom class objects
  setFields.Add("clan_info", setClanInfo);

  // Send data
  await channel.UpdatePartialAsync(setFields);

  // Data is now available via CustomData property
  var frags = channel.CustomData.Get<int>("frags");
  var items = channel.CustomData.Get<List<string>>("items");
  var clanInfo = channel.CustomData.Get<ClanData>("clan_info");
}

// Example class with data that you can assign as Channel custom data
private class ClanData
{
  public int MaxMembers;
  public string Name;
  public List<string> Tags;
}

Full Update

The update function updates all of the channel data. Any data that is present on the channel and not included in a full update will be deleted.

var updateRequest = new StreamUpdateOverwriteChannelRequest
{
  Name = "New name",
  CustomData = new StreamCustomDataRequest
  {
    {"my-custom-int", 12},
    {"my-custom-array", new string[]{"one", "two"}}
  }
};

// This request will have all channel data removed except what is being passed in the request
await channel.UpdateOverwriteAsync(updateRequest);

// You can also pass an instance of channel to the request constructor to have all of the date copied over
// This way you alter only the fields you wish to change
var updateRequest2 = new StreamUpdateOverwriteChannelRequest(channel)
{
  Name = "Brand new name"
};

// This will update only the name because all other data was copied over
await channel.UpdateOverwriteAsync(updateRequest2);

Request Params

NameTypeDescriptionOptional
channel dataobjectObject with the new channel information. One special field is “frozen”. Setting this field to true will freeze the channel. Read more about freezing channels in “Freezing Channels”
textobjectMessage object allowing you to show a system message in the Channel that something changed.Yes

Updating a channel using these methods cannot be used to add or remove members. For this, you must use specific methods for adding/removing members, more information can be found here.

Adding & Removing Channel Filter Tags

Using the addFilterTags() method adds tags to categorize a channel, while removeFilterTags() removes them.

const channel = client.channel("messaging", "support-123");

// Add filter tags
await channel.addFilterTags(["premium", "urgent"]);

// Remove filter tags
await channel.removeFilterTags(["urgent"]);

Limits: A channel can have a maximum of 10 tags total. Each tag is limited to 255 characters. Tags are automatically sorted and deduplicated by the system.

Filter tags can also be set when creating the channel. See Creating Channels for more details, and Querying Channels for filtering channels by tags.