Updating a Channel

Last Edit: Oct 19 2020

You can edit a Channel using the update method:


const update = await channel.update(
    {
        name: 'myspecialchannel',
        color: 'green',
    },
    { text: 'Thierry changed the channel color to green', user_id: "Thierry" },
);
                    

await channel.update({
  "name": "myspecialchannel",
  "color": "green",
}, Message(text: "Thierry changed the channel color to green"));
                    

$update = $channel->update(
	[
		'name'    => 'myspecialchannel', 
		'color'	  => 'green'
	],
	[ 
		'text' => 'Thierry changed the channel color to green',
		'user_id' => 'thierry'
	]
);
                    

val updateMessage = Message()
updateMessage.text = "Thierry changed the channel color to green"
channelController.update(updateMessage).enqueue {
    val channel = it.data()
}
                    

let channel = Client.shared.channel(type: .messaging, id: "general")
    
channel.update(name: "my special channel") { (result) in
    // handle result
}

// System messages are not supported in Swift SDK yet
                    

Request Params

Name Type Description Optional
channel data object Object 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"
text object Message 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.