Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Home
/
Chat
/
JavaScript
/
Channel
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

Invite users as members

To enter a private group channel, a user must be invited by members who are already in the group channel.

const userIds: string[] = ['Sally', 'Harry'];
await channel.inviteWithUserIds(userIds);

You can also determine whether the newly joined user can see the past messages in the channel or not. You can manage the settings on Sendbird Dashboard. Go to the Settings > Chat > Channels > Group channels, and you will see the Chat history option. If the option is turned on, the newly joined member can view all messages sent before they have joined the channel. If turned off, the new member can only see messages sent after they have been invited. By default, this option is turned on.