/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Invite users as members

Copy link

To enter a private group channel, a user must be invited by members who are already in the private group channel. On the other hand, an invitation isn't required to join a public group channel.

JavaScriptTypeScript
const userIds = ['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 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.