Updating a Channel

Last Edit: Sep 22 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 <code>frozen</code>. If you set that to true new messages will be blocked.
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.