await channel.updatePartial({
set: {
config_overrides: {
blocklist: "medical_blocklist",
blocklist_behavior: "block",
},
},
});
Channel-level settings
In most cases you define your channel settings and features at the Channel Type level and then have these inherited by all the channels of the same type. For instance you can configure Livestream channels without typing events and enable reactions and replies for all Messaging type channels.
This approach does not work well if your application has many different combination of settings for channels and that is when channel-level settings can be useful.
Channel-level settings allow you to override one or more settings for a channel without changing other channels of the same type. A few important things to mention about channel-level settings:
Settings that are not overridden at channel level will use the current setting from the channel type
Changing channel-level settings can only be done server-side
List of settings that can be overridden
Not all channel type settings can be configured at the channel level, here is the complete list of settings that can be overridden.
typing_events : Controls if typing indicators are shown.
reactions : Controls if users are allowed to add reactions to messages.
replies : Enables message threads and replies.
uploads : Allows image and file uploads within messages.
url_enrichment : When enabled, messages containing URLs will be enriched automatically with image and text related to the message.
commands : Enable a set of commands for this channel.
max_message_length : The max message length.
blocklist : A list of words you can define to moderate chat messages. More information can be found here.
blocklist_behavior : set as
block
orflag
to determine what happens to a message containing blocked words.grants : Allows to modify channel-type permission grants for particular channel. More information can be found here
Examples
Use a different blocklist
channel.update_partial(
{
config_overrides: {
blocklist: "medical_blocklist",
blocklist_behavior: "block",
},
}
)
channel.update_partial(
{
"config_overrides": {
"blocklist": "medical_blocklist",
"blocklist_behavior": "block",
},
}
)
$channel->updatePartial([
"config_overrides" => [
"blocklist" => "medical_blocklist",
"blocklist_behavior" => "block"
]
]);
partialUpdate := stream.PartialUpdate{
Set: map[string]interface{}{
"config_overrides": map[string]interface{}{
"blocklist": "medical_blocklist",
"blocklist_behavior": "block",
},
},
}
channel.PartialUpdate(partialUpdate)
var configOverrides = new HashMap<String, String>();
configOverrides.put("blocklist", "medical_blocklist");
configOverrides.put("blocklist_behavior", "block");
Channel.partialUpdate("<channel-type>", "<channel-id>")
.setValue("config_overrides", configOverrides)
.request();
var channelUpdates = new PartialUpdateChannelRequest
{
Set = new Dictionary<string, object>
{
{ "config_overrides", new Dictionary<string, string>
{
{ "blocklist", "medical_blocklist" }, { "blocklist_behavior", "block" }
}
}
},
};
await channelClient.PartialUpdateAsync("<channel-type>", "<channel-id>", channelUpdates);
Disables replies
await channel.updatePartial({ set: { config_overrides: { replies: false } } });
channel.update_partial({config_overrides: {replies: false}})
channel.update_partial({"config_overrides": {"replies": False}})
$channel->updatePartial(["config_overrides" => ["replies" => false]);
partialUpdate := stream.PartialUpdate{
Set: map[string]interface{}{
"config_overrides": map[string]interface{}{
"replies": false,
},
},
}
channel.PartialUpdate(partialUpdate)
var configOverrides = new HashMap<String, Boolean>();
configOverrides.put("replies", false);
Channel.partialUpdate("<channel-type>", "<channel-id>")
.setValue("config_overrides", configOverrides)
.request();
var channelUpdates = new PartialUpdateChannelRequest
{
Set = new Dictionary<string, object>
{
{ "config_overrides", new Dictionary<string, object> { {"replies", false } } },
},
};
await channelClient.PartialUpdateAsync("<channel-type>", "<channel-id>", channelUpdates);
Remove overrides and go back to default settings
await channel.updatePartial({ set: { config_overrides: {} } });
$channel.updatePartial(["config_overrides" => []]);
channel.update_partial({"config_overrides": {}})
$channel->updatePartial(["config_overrides" => []]);
partialUpdate := stream.PartialUpdate{
Set: map[string]interface{}{
"config_overrides": map[string]interface{}{},
},
}
channel.PartialUpdate(partialUpdate)
Channel.partialUpdate("<channel-type>", "<channel-id>")
.setValue("config_overrides", new HashMap<String, String>())
.request();
var channelUpdates = new PartialUpdateChannelRequest
{
Set = new Dictionary<string, object>
{
{ "config_overrides", new Dictionary<string, object>() },
},
};
await channelClient.PartialUpdateAsync("<channel-type>", "<channel-id>", channelUpdates);