How can a user Join a Channel?

We would like to know how a user can join a live channel?

  • is it possible?
  • or is it only via admin ( only invite) as mentioned in the documentation?

If we have a user, we would like them to join the channel only if that user wants, so the scenario is, only certain users are able to join the channels without admin intervention, is it possible via the Live Channel?

Could you also kindly help update the documentation on what are the different types of channels described in here https://docs.amity.co/chat/web/channels#join-channel ?

Hello @sijanshs,

Joining a channel can be achieved by calling ChannelRepository.joinChannel regularly (even live).

About the types of channels in the documentation, we confirmed it is up to date already. The different types of channels can be found at https://docs.amity.co/chat/web/channels#channel-types .

Thanks @Julien for confirming that, however, i found that I was not able to get a correct response from ChannelRepository.joinChannel.

Once I call the endpoint with the following code

  const addToChannel = useCallback(async () => {
    const repo = await channelRepo.joinChannel({
      channelId,
      type: ChannelType.Standard
    });
    console.log({ repo });
  }, [channelId]);

The repo returns a live object but is not updated, the user does not seem to have joined the channel.

Could you please share some examples if possible?

Code example in here, CodeSandbox Link

There’s no use of await when a method returns a live object since the updates are passing through the live object itself.

Instead, you can try to use the ChannelRepository.joinChannel which returns a promise (so you can use await).