Changing Channel Members

Last Edit: Nov 27 2020

Adding & Removing Channel Members

Using the addMembers() method adds the given users as members, while removeMembers() removes them.

await channel.addMembers(['thierry', 'josh']);
await channel.removeMembers(['tommaso']);

// Optional message object for channel members notification, works for both add and remove members
await channel.addMembers(['tommaso'], { text: 'Tommaso joined the channel.' }); // using browser client
await channel.addMembers(['tommaso'], { text: 'Tommaso joined the channel.', user_id: 'tommaso' }); // using server-side client

await channel.addMembers(["thierry", "josh"]);
await channel.removeMembers(["tommaso"]);

$channel->addMembers(['thierry', 'jenny']);
$channel->removeMembers(['thierry', 'jenny']);

channelController.addMembers("thierry", "josh").enqueue { 
    val channel =
channelController.removeMembers("thierry", "josh").enqueue {
    val channel =

let channel = .messaging, id: "general")

let newChannel = .messaging, id: "family")

Client.shared.queryChannel(channel) { (result) in
    do {
        let response = try result.get()
        let channelMembers =

				// Add member
				newChannel.add(member: channelMembers.first!) { (result) in
				    // handle result

				// or, add all members
				newChannel.add(members: channelMembers) { (result) in /**/ }

				// Remove member
				channel.remove(member: channelMembers.first!) { (result) in /**/ }

				// or, remove all members
				channel.remove(members: channelMembers) { (result) in /**/ }
    } catch {
        // handle error
Note: You can only add/remove up to 100 members at once.

Adding & Removing Moderators to a Channel

Using the addModerators() method adds the given users as moderators (or updates their role to moderator if already members), while demoteModerators() removes the moderator status.

await channel.addModerators(['thierry', 'josh']);
await channel.demoteModerators(['tommaso']);

channel.add_moderators(["thierry", "josh"]);

channel.add_moderators(["thierry", "josh"]);

$channel->addModerators(['thierry', 'jenny']);
$channel->demoteModerators(['thierry', 'jenny']);

// at the moment we don't have a Java client for server side usage

// at the moment we don't have a Swift client for server side usage

await channel.AddModerators(new string[] { "thierry", "josh" });
await channel.DemoteModerators(new string[] { "tommaso" });

// Adding and Removing Moderators is only allowed server-side

newModerators := []string{"bob", "sue"}
err = channel.AddModerators("thierry", "josh")
err = channel.AddModerators(newModerators...)
err = channel.DemoteModerators(newModerators...)
These operations can only be performed server-side and up to 100 moderators can be added or removed at once.