JavaScript Chat

Integrate CometChat with your JavaScript Site!

Bring your imagination to reality by building your in-app chat just the way you want, without any restrictions. CometChat Pro Chat SDK gives you the required flexibility and building blocks to create and customize your own UI, to create a reliable, scalable & qualitative chat experience for your users.

Integration Time: 30-60 minutes

Trusted by more than 50000 customers in over 127 countries

Designed for Developers to take control

Get complete control of your UI by integrating CometChat Pro Chat SDK in your JavaScript web app and swiftly deploy your ideas into reality.

var GUID = "GUID";
var password = "";
var groupType = CometChat.GROUP_TYPE.PUBLIC;

CometChat.joinGroup(GUID, groupType, password).then(
 group => {
  console.log("Group joined successfully:", group);
 error => {
  console.log("Group joining failed with exception:", error);

var listenerID = "UNIQUE_LISTENER_ID";

 new CometChat.MessageListener({
  onTextMessageReceived: textMessage => {
   console.log("Text message successfully", textMessage);
   // Handle text message
  onMediaMessageReceived: mediaMessage => {
   console.log("Media message received successfully",  mediaMessage);
   // Handle media message

var receiverID = "UID";
var messageText = "Hello world!";
var messageType = CometChat.MESSAGE_TYPE.TEXT;
var receiverType = CometChat.RECEIVER_TYPE.USER;

var textMessage = new CometChat.TextMessage(receiverID, messageText, messageType, receiverType);

  message => {
    console.log("Message sent successfully:", message);
    // Text Message Sent Successfully
  error => {
    console.log("Message sending failed with error:", error);

var limit = 30;
var usersRequest = new CometChat.UsersRequestBuilder().setLimit(limit).build();

  userList => {
    /* userList will be the list of User class. */
    console.log("User list received:", userList);
    /* retrived list can be used to display contact list. */
  error => {
    console.log("User list fetching failed with error:", error);


Easiest way to add & customize chat in your app

Built & battle tested

CometChat Pro deploys over 50K+ automated tests across multiple platforms to ensure our chat works across every browser & updates.

Don’t build it from scratch

Our SDKs help save time by focussing on code that matters without having to reinvent the wheel. Quickstarts, developer documentation, open source sample code and our pre-built sample apps help you get up and running quickly.

Scale with confidence

We help you build a chat app that can be scaled from a startup to an enterprise within minutes without having to outsource your dev team. Our SDKs support every use case right out of the box with minimum latency, unparalleled uptime & flexibility.

Control your UI

CometChat Pro SDKs helps you make & manage your chat UI exactly the way you need. Start from our chat layout & build on top of it. Personalise chat experience for your users by customizing chat bubbles, calling profiles and so much more.