joinRoom(options)
Call this method to join the Chat Room. This method can be used to automatically join the user to the chat room.
sdk.joinRoom({
uniqueUserIdentifier: uniqueUserIdentifier
username,
roomPassword,
accessToken: accessToken,
email,
password
});
joinRoom Options
You can join a chat room using one of the following parameters:
- uniqueUserIdentifier
- accessToken
- username (not recommended)
- 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 Name | Description | Type | Required |
---|---|---|---|
uniqueUserIdentifier | Unique User Identifier of the chat user | String | Required when accessToken or email is not specified |
username | Username of the chat user (not recommended, use uniqueUserIdentifier or accessToken instead) | String | Required when accessToken or email is not specified |
roomPassword | Password of the room, if the room is password protected | String | Required when the room is password protected |
accessToken | Access token of the chat room. | String | Required when username or email is not specified |
email of the chat user | String | Required when username or accessToken is not specified | |
password | password to enter the user as a Moderator | String | Required 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.