Join / Leave Channel

1. Join Channel

circle-info

Anyone can join a public channel even without invitation from the owner.

await client.joinChannel({
    channelId: 'some_public_channel',
});

2. Join InvitationOnly Channel

circle-info

In order to join an invitationOnly channel, you need to know the channel’s invitationCode.

await client.joinChannelByInvitationCode({
    channelId: 'some_invitation_only_channel',
    invitationCode: 'secret_phrase',
});

3. Leave Channel

await client.leaveChannel({channelId: 'some_channel'});
circle-info

If you are the last remaining channel member and you set deleteChannelIfEmpty parameter to true when leaving the channel, the channel will be deleted.

await client.leaveChannel({
	channelId: 'some_channel', 
	deleteChannelIfEmpty: true, // if I am the last member, channel will be deleted when I leave
});

Last updated