Skip to main content

Package Manager

Install the SDK using npm:
npm install @cometchat/chat-sdk-javascript
Then import the CometChat object wherever you need it:
import { CometChat } from "@cometchat/chat-sdk-javascript";

CDN

Include the CometChat JavaScript library directly in your HTML:
<script
  type="text/javascript"
  src="https://unpkg.com/@cometchat/chat-sdk-javascript/CometChat.js"
></script>
When using the CDN, CometChat is available as a global variable.

Get Your Credentials

Before initializing the SDK, get your credentials from the CometChat Dashboard:
  1. Sign up or log in
  2. Create a new app (or use an existing one)
  3. Go to API & Auth Keys and note your:
    • App ID
    • Region
    • Auth Key
Auth Key is for development/testing only. In production, generate Auth Tokens on your server using the REST API. Never expose Auth Keys in production client code.

Next Steps

Initialization

Configure and initialize the SDK

SSR Compatibility

Setup for Next.js, Nuxt, and Ionic