CometChat Pro Documentation

You'll find comprehensive guides and documentation to help you start working with CometChat as quickly as possible. Let's jump right in!

Get your Application Keys

Signup for CometChat and then:

  1. Create a new app
  2. Head over to the API Keys section and click on the Create API Key button
  3. Enter a name and select the scope as Auth Only
  4. Now note the API Key and App ID

Add the CometChat Dependency

Web (Browser)

First,simply connect the JS file as a normal script:

 Your html code
<script type="text/javascript" src=""></script>

<script type="text/javascript">
 window.onload = (function () {
  // window scoped variable called `CometChat` is created.

Then a window scoped variable called CometChat is created.

Or install the package as NPM module:

npm install @cometchat-pro/chat --save

And add the script to HTML file from the 'node_modules' folder (as a relative path):

<script src="~/node_modules/@cometchat-pro/chat/CometChat.js" type="text/javascript"></script>


First, install the package as NPM module:

npm install @cometchat-pro/chat@1.8.3 --save

Then start using CometChat

import { CometChat } from "@cometchat-pro/chat";

Initialize CometChat

The init() method initializes the settings required for CometChat.

You need to call init() before calling any other method from CometChat.

<script type="text/javascript" src=""></script>

<script type="text/javascript">
 window.onload = (function () {
  var appId = "APP_ID";
   () => {
    console.log("Initialization completed successfully");
    //You can now call login function.
   error => {
    console.log("Initialization failed with error:", error);
    //Check the reason for error and take apppropriate action.


CometChat App ID


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.