Skip to main content

joinRoom(options)

Call this method to join the Chat Room. This method can be used to automatically join the user to the chat room.

JavaScript

sdk.joinRoom({
uniqueUserIdentifier: uniqueUserIdentifier
username,
roomPassword,
accessToken: accessToken,
email,
password
});

joinRoom Options

You can join a chat room using one of the following parameters:

  1. uniqueUserIdentifier
  2. accessToken
  3. username (not recommended)
  4. email (not recommend)

username

Just specify any username and join the user. The username does not have to be unique. This method is not recommended use the uniqueUserIdentifier instead.

accessToken

You can generate the accessToken for the user via the REST API. You can learn about creating an accessToken token from here..

Email

When you create a moderator from the dashboard, it gives you an email and password for the moderator, you can use the email and password fields to specify the email and password for the moderator. This method is not recommended, use the accessToken instead, read the guide to learn more. Migrating to New Join Modal

You can also use the accessToken to login the moderator, learn about creating a moderator via the API here..

Parameter NameDescriptionTypeRequired
uniqueUserIdentifierUnique User Identifier of the chat userStringRequired when accessToken or email is not specified
usernameUsername of the chat user (not recommended, use uniqueUserIdentifier or accessToken instead)StringRequired when accessToken or email is not specified
roomPasswordPassword of the room, if the room is password protectedStringRequired when the room is password protected
accessTokenAccess token of the chat room.StringRequired when username or email is not specified
emailemail of the chat userStringRequired when username or accessToken is not specified
passwordpassword to enter the user as a ModeratorStringRequired when you want the user to be a Moderator, if you are using email to login the user

Specifying Profile Picture and Custom Metadata for the user

To specify profile picture and custom metadata for the user, you can use the Create User API to generate the accessToken and login the user. The Create User API allows you to specify externalUserId, meta and profilePic URL.