Skip to main content
This guide covers generating call tokens and joining call sessions using the CometChat Calls SDK.

Generate Token

Before joining a call, you need to generate a call token. The token authenticates the user for the specific call session.
ParameterTypeRequiredDescription
sessionIdstringYesUnique identifier for the call session
authTokenstringNoUser’s auth token (uses logged-in user’s token if not provided)
The sessionId should be unique for each call. You can use a UUID, a combination of user IDs, or any unique string that identifies the call session.

Join Session with Component

The CometChatCalls.Component renders the call UI. Pass the generated token and a plain sessionSettings object to join the session. Subscribe to call events with CometChatCalls.addEventListener and unsubscribe on cleanup.

Component Props

PropTypeRequiredDescription
callTokenstringYesToken generated from generateToken()
sessionSettingsobjectNoPlain session settings object

Complete Example

Error Handling

Common errors when joining a session:
Error CodeDescription
ERROR_SESSION_ID_MISSINGSession ID is empty or not provided
ERROR_AUTH_TOKEN_MISSINGUser is not logged in or auth token is missing
ERROR_SDK_NOT_INITIALIZEDSDK not initialized. Call init() first