# JavaScript chat libraries

JavaScript chat libraries connect an app to a messaging service that stores conversations and delivers new messages in real time. Most of them are client SDKs for a hosted service that also issues the user tokens. These libraries add direct messages, group channels, and support chat to marketplaces, communities, and customer apps.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Stream Chat](#stream-chat) | 3.3M | 211 | Nov 2026 | Stream proprietary SDK license |
| [matrix-js-sdk](#matrix-js-sdk) | 1.9M | 2.2K | Nov 2026 | Apache-2.0 |
| [@aws-sdk/client-chime-sdk-messaging](#aws-sdk-client-chime-sdk-messaging) | 1.4M | 3.7K | Nov 2026 | Apache-2.0 |
| [Ably Chat](#ably-chat) | 1.2M | 23 | Nov 2026 | Apache-2.0 |
| [Sendbird Chat](#sendbird-chat) | 906.3K | 32 | Nov 2026 | Sendbird SDK license |
| [Twilio Conversations](#twilio-conversations) | 875.6K | Not on GitHub | Sep 2026 | MIT |
| [Azure Communication Chat](#azure-communication-chat) | 223.5K | 2.3K | Jun 2025 | MIT |
| [TalkJS](#talkjs) | 223.4K | Not on GitHub | May 2026 | TalkJS proprietary license |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Stream Chat](#stream-chat) has the most monthly downloads in this comparison, at 3.3M.

## Capabilities

| Library | Live message subscriptions | Bundled conversation UI | OSI-approved SDK license |
| --- | --- | --- | --- |
| [Stream Chat](#stream-chat) | Yes | Via plugin | No |
| [matrix-js-sdk](#matrix-js-sdk) | Yes | No | Yes |
| [@aws-sdk/client-chime-sdk-messaging](#aws-sdk-client-chime-sdk-messaging) | Via plugin | No | Yes |
| [Ably Chat](#ably-chat) | Yes | Via plugin | Yes |
| [Sendbird Chat](#sendbird-chat) | Yes | Via plugin | No |
| [Twilio Conversations](#twilio-conversations) | Yes | No | Yes |
| [Azure Communication Chat](#azure-communication-chat) | Yes | Via plugin | Yes |
| [TalkJS](#talkjs) | Yes | Yes | No |

## Libraries

### Stream Chat

[GitHub](https://github.com/GetStream/stream-chat-js) · [npm](https://www.npmjs.com/package/stream-chat) · [Docs](https://getstream.io/chat/docs/javascript/)

Connects frontend or backend applications to the Stream Chat service.

- Downloads / mo: 3.3M
- Stars: 211
- Last release: 10.1.0
- License: Stream proprietary SDK license
- Capabilities: [From the Stream Chat docs](https://getstream.io/chat/docs/javascript/)

**Strengths**

- **Accepts a renewing token provider.** Supply a token provider to refresh authentication after expiry.
- **Supports external attachment storage.** Upload attachments to Stream's CDN or a separate CDN.

**Watch out for**

- **User tokens need a server.** Generate signed user tokens on the app's server, where the secret stays.
- **Privacy settings suppress read events.** Disabled read-receipt sharing hides read status from other users.

```sh
npm install stream-chat
```

**Quickstart**

```javascript
import { StreamChat } from "stream-chat";

const client = StreamChat.getInstance("{{ api_key }}");
// you can still use new StreamChat("api_key");

await client.connectUser(
  {
    id: "jlahey",
    name: "Jim Lahey",
    image: "https://i.imgur.com/fR9Jz14.png",
  },
  "{{ chat_user_token }}",
);

```

From [init-and-users](https://getstream.io/chat/docs/javascript/init-and-users/) · [Find projects using Stream Chat →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20stream-chat%20for%20room%20notifications%2C%20connection%20recovery%2C%20conversation%20creation%20and%20participant%20management&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### matrix-js-sdk

[GitHub](https://github.com/matrix-org/matrix-js-sdk) · [npm](https://www.npmjs.com/package/matrix-js-sdk) · [Docs](https://matrix-org.github.io/matrix-js-sdk/index.html)

Provides a Matrix client for JavaScript and TypeScript chat applications.

- Downloads / mo: 1.9M
- Stars: 2.2K
- Last release: 45.1.0
- License: Apache-2.0
- Capabilities: [From the matrix-js-sdk docs](https://matrix-org.github.io/matrix-js-sdk/index.html)

**Strengths**

- **Supports end-to-end encryption.** Initialize the Rust crypto backend to enable encrypted chat.
- **Loads earlier room messages.** Use scrollback to add older messages to a room timeline.

**Watch out for**

- **Encryption needs explicit initialization.** Call initRustCrypto before using the client’s encryption APIs.
- **Temporary crypto storage changes devices.** Without persistent storage, create a new device each application start.

```sh
pnpm add matrix-js-sdk
```

**matrix-org/matrix-react-sdk** (1.1K stars)

[matrix-org/matrix-react-sdk](https://github.com/matrix-org/matrix-react-sdk) 

```javascript
export function getRoomNotifsState(client: MatrixClient, roomId: string): RoomNotifState | null {
    if (client.isGuest()) return RoomNotifState.AllMessages;

    // look through the override rules for a rule affecting this room:
    // if one exists, it will take precedence.
    const muteRule = findOverrideMuteRule(client, roomId);
    if (muteRule) {
        return RoomNotifState.Mute;
    }

    // for everything else, look at the room rule.
    let roomRule: IPushRule | undefined;
    try {
        roomRule = client.getRoomPushRule("global", roomId);
    } catch (err) {
        // Possible that the client doesn't have pushRules yet. If so, it
        // hasn't started either, so indicate that this room is not notifying.
        return null;
    }

    // XXX: We have to assume the default is to notify for all messages
    // (in particular this will be 'wrong' for one to one rooms because
    // they will notify loudly for all messages)
    if (!roomRule?.enabled) return RoomNotifState.AllMessages;

    // a mute at the room level will still allow mentions
    // to notify
    if (isMuteRule(roomRule)) return RoomNotifState.MentionsOnly;

    const actionsObject = PushProcessor.actionListToActionsObject(roomRule.actions);
    if (actionsObject.tweaks.sound) return RoomNotifState.AllMessagesLoud;

    return null;
}

```

[src/RoomNotifs.ts](https://github.com/matrix-org/matrix-react-sdk/blob/b67a2303f912a8cab5caf089f3ea710850aa252c/src/RoomNotifs.ts#L41-L74) · [More projects using matrix-js-sdk →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20matrix-js-sdk%20for%20room%20notifications%2C%20connection%20recovery%2C%20conversation%20creation%20and%20participant%20management&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import * as sdk from "matrix-js-sdk";
const client = sdk.createClient({ baseUrl: "https://matrix.org" });
const rooms = await client.publicRooms({ limit: 10 });

```

From [README.md](https://github.com/matrix-org/matrix-js-sdk/blob/develop/README.md)

### @aws-sdk/client-chime-sdk-messaging

[GitHub](https://github.com/aws/aws-sdk-js-v3) · [npm](https://www.npmjs.com/package/@aws-sdk/client-chime-sdk-messaging) · [Docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/chime-sdk-messaging/)

Sends and receives messages in custom messaging apps through the Amazon Chime SDK messaging APIs.

- Downloads / mo: 1.4M
- Stars: 3.7K
- Last release: 3.1171.0
- License: Apache-2.0
- Capabilities: [From the @aws-sdk/client-chime-sdk-messaging docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/chime-sdk-messaging/)

**Watch out for**

- **Depends on the identity APIs.** Set up users through the Amazon Chime SDK identity APIs before sending messages.

```sh
npm install @aws-sdk/client-chime-sdk-messaging
```

**Quickstart**

```typescript
import { ChimeSDKMessagingClient, ListChannelFlowsCommand } from "@aws-sdk/client-chime-sdk-messaging";
const client = new ChimeSDKMessagingClient({ region: "REGION" });
const data = await client.send(new ListChannelFlowsCommand({ AppInstanceArn: "APP_INSTANCE_ARN" }));

```

From [README.md](https://cdn.jsdelivr.net/npm/@aws-sdk/client-chime-sdk-messaging@3.1171.0/README.md) · [Find projects using @aws-sdk/client-chime-sdk-messaging →](https://dashboard.exa.ai/playground/search?q=%40aws-sdk/client-chime-sdk-messaging%20GitHub%20projects)

### Ably Chat

[GitHub](https://github.com/ably/ably-chat-js) · [npm](https://www.npmjs.com/package/@ably/chat) · [Docs](https://ably.com/docs/chat)

Provides chat room APIs built on Ably's realtime platform.

- Downloads / mo: 1.2M
- Stars: 23
- Last release: 2.0.0
- License: Apache-2.0
- Capabilities: [From the Ably Chat docs](https://ably.com/docs/chat)

**Watch out for**

- **Built for person-to-person chat.** Conversations with an AI agent use Ably AI Transport, a separate product.

```sh
npm install @ably/pubsub-device @ably/chat
```

**Quickstart**

```typescript
import { createClient } from '@ably/pubsub-device';
import { createChatClient, RoomStatus, RoomStatusChange } from '@ably/chat';

// Initialize Ably Pub/Sub Realtime client
// Note: For client-side applications, token authentication is recommended.
// See: https://ably.com/docs/auth
const pubsubClient = createClient({
  key: '<your-ably-api-key>',
  clientId: 'your-client-id',
});

// Create a chat client
const chatClient = createChatClient(pubsubClient);

// Get a chat room
const room = await chatClient.rooms.get('my-room');

// Monitor room status
room.onStatusChange((statusChange: RoomStatusChange) => {
  switch (statusChange.current) {
    case RoomStatus.Attached:
      console.log('Room is attached');
      break;
    case RoomStatus.Detached:
      console.log('Room is detached');
      break;
    case RoomStatus.Failed:
      console.log('Room failed:', statusChange.error);
      break;
    default:
      console.log('Room status:', statusChange.current);
  }
});

// Subscribe to messages
const subscription = room.messages.subscribe((event) => {
  console.log('Received message:', event.message.text);
});

// Attach to the room
await room.attach();

// Send a message
await room.messages.send({ text: 'Hello, World!' });

```

From [README.md](https://cdn.jsdelivr.net/npm/@ably/chat@2.0.0/README.md) · [Find projects using Ably Chat →](https://dashboard.exa.ai/playground/search?q=%40ably/chat%20GitHub%20projects)

### Sendbird Chat

[GitHub](https://github.com/sendbird/sendbird-chat-sdk-javascript) · [npm](https://www.npmjs.com/package/@sendbird/chat) · [Docs](https://sendbird.com/docs/chat/sdk/v4/javascript/overview)

Adds real-time chat through Sendbird open channels or group channels.

- Downloads / mo: 906.3K
- Stars: 32
- Last release: 4.22.16
- License: Sendbird SDK license
- Capabilities: [From the Sendbird Chat docs](https://sendbird.com/docs/chat/sdk/v4/javascript/overview)

**Strengths**

- **Provides open and group channels.** Choose an open channel or group channel for the conversation.
- **Reports group typing status.** Receive typing updates from other members of a group channel.

**Watch out for**

- **Initialize required channel modules.** Import channel modules and provide them during SDK initialization.
- **New-member history depends on settings.** Configure chat history before new members need older messages.

```sh
npm install @sendbird/chat
```

**sendbird/sendbird-uikit-react** (240 stars)

[sendbird/sendbird-uikit-react](https://github.com/sendbird/sendbird-uikit-react) 

```javascript
const startConnectionSession = (
  store: object,
  sdk: SdkStore['sdk'],
  { userId, onRecover, onDelayChange }: {
    userId: string;
    onRecover: (user: User) => void;
    onDelayChange?: (retryAfter: number | null) => void;
  },
): ConnectionSession => {
  endConnectionSession(store);
  const session: ConnectionSession = {
    sdk,
    handlerId: `sendbird-uikit-react-connection-${uuidv4()}`,
    awaitingRecovery: false,
    onDelayChange,
  };
  const recover = () => {
    if (!session.awaitingRecovery || connectionSessions.get(store) !== session) return;
    const user = sdk.currentUser;
    if (!user || user.userId !== userId) return;
    session.awaitingRecovery = false;
    onRecover(user);
  };
  const settleDelay = () => {
    onDelayChange?.(null);
    recover();
  };
  sdk.addConnectionHandler(session.handlerId, new ConnectionHandler({
    onConnectionDelayed: (retryAfter: number) => onDelayChange?.(retryAfter),
    onConnected: settleDelay,
    onReconnectSucceeded: settleDelay,
  }));
  connectionSessions.set(store, session);
  return session;
};

```

[src/lib/Sendbird/context/hooks/useSendbird.tsx](https://github.com/sendbird/sendbird-uikit-react/blob/ddc0fe55e883107a8a873fd3f078d114b5fd3e11/src/lib/Sendbird/context/hooks/useSendbird.tsx#L49-L83) · [More projects using Sendbird Chat →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20%40sendbird/chat%20for%20room%20notifications%2C%20connection%20recovery%2C%20conversation%20creation%20and%20participant%20management&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import SendbirdChat from "@sendbird/chat";
import { OpenChannelModule } from "@sendbird/chat/openChannel";

const sb = SendbirdChat.init({
  appId: APP_ID,
  modules: [new OpenChannelModule()],
});


// The USER_ID below should be unique to your Sendbird application.
try {
  const user = await sb.connect(USER_ID);
  // The user is connected to Sendbird server.
} catch (err) {
  // Handle error.
}

```

From [README.md](https://cdn.jsdelivr.net/npm/@sendbird/chat@4.22.16/README.md)

### Twilio Conversations

[npm](https://www.npmjs.com/package/@twilio/conversations) · [Docs](https://www.twilio.com/docs/conversations-classic)

Provides the JavaScript client for Twilio Conversations classic.

- Downloads / mo: 875.6K
- Last release: 3.0.1
- License: MIT
- Capabilities: [From the Twilio Conversations docs](https://www.twilio.com/docs/conversations-classic)

**Strengths**

- **Paginates conversation history.** Retrieve messages through the built-in paginator interface.
- **Sends media attachments.** Send media messages within a conversation.

**Watch out for**

- **Read status needs application updates.** Update the read horizon when the user views messages.
- **Message indexes contain gaps.** Compare indexes without treating their difference as a message count.

```sh
npm install --save @twilio/conversations
```

**twilio/twilio-conversations-demo-react** (123 stars)

[twilio/twilio-conversations-demo-react](https://github.com/twilio/twilio-conversations-demo-react) 

```javascript
export async function addConversation(
  name: string,
  updateParticipants: (participants: Participant[], sid: string) => void,
  client?: Client,
  addNotifications?: (notifications: NotificationsType) => void
): Promise<Conversation> {
  if (client === undefined) {
    throw new Error(
      "Client is suddenly undefined, are you sure everything is ok?"
    );
  }

  if (name.length === 0) {
    throw new Error("Conversation name is empty");
  }

  try {
    const conversation = await client.createConversation({
      friendlyName: name,
    });
    await conversation.join();

    const participants = await conversation.getParticipants();
    updateParticipants(participants, conversation.sid);

    successNotification({
      message: CONVERSATION_MESSAGES.CREATED,
      addNotifications,
    });

    return conversation;
  } catch (e) {
    unexpectedErrorNotification(e.message, addNotifications);
    throw e;
  }
}

```

[src/api.ts](https://github.com/twilio/twilio-conversations-demo-react/blob/2dd219228ffa829e2e365643a55fc7523fc5bb8f/src/api.ts#L29-L64) · [More projects using Twilio Conversations →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20%40twilio/conversations%20for%20room%20notifications%2C%20connection%20recovery%2C%20conversation%20creation%20and%20participant%20management&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { Client } from '@twilio/conversations';

const client = new Client(token);

// Before you use the client, subscribe to the `'initialized'` event.
client.on('initialized', () => {
  // Use the client.
});

// To catch client initialization errors, subscribe to the `'initFailed'` event.
client.on('initFailed', ({ error }) => {
  // Handle the error.
});

```

From [index.html](https://cdn.jsdelivr.net/npm/@twilio/conversations@3.0.1/README.md)

### Azure Communication Chat

[GitHub](https://github.com/Azure/azure-sdk-for-js) · [npm](https://www.npmjs.com/package/@azure/communication-chat) · [Docs](https://learn.microsoft.com/en-us/javascript/api/overview/azure/communication-chat-readme?view=azure-node-latest)

Sends messages between users in chat threads on Azure Communication Services.

- Downloads / mo: 223.5K
- Stars: 2.3K
- Last release: 1.6.0
- License: MIT
- Capabilities: [From the Azure Communication Chat docs](https://learn.microsoft.com/en-us/javascript/api/overview/azure/communication-chat-readme?view=azure-node-latest)

**Strengths**

- **Joins Teams meetings.** Chat clients can join Microsoft Teams meetings and exchange Teams chat messages.

```sh
npm install @azure/communication-chat @azure/communication-common
```

**Quickstart**

```typescript
import { AzureCommunicationTokenCredential } from "@azure/communication-common";
import { ChatClient } from "@azure/communication-chat";

// Your unique Azure Communication service endpoint
const endpointUrl = "<ENDPOINT>";
const userAccessToken = "<USER_ACCESS_TOKEN>";
const tokenCredential = new AzureCommunicationTokenCredential(userAccessToken);
const chatClient = new ChatClient(endpointUrl, tokenCredential);

const createChatThreadRequest = {
  topic: "Hello, World!",
};

const createChatThreadOptions = {
  participants: [
    {
      id: { communicationUserId: "<USER_ID>" },
      displayName: "<USER_DISPLAY_NAME>",
    },
  ],
};

const createChatThreadResult = await chatClient.createChatThread(
  createChatThreadRequest,
  createChatThreadOptions,
);

const threadId = createChatThreadResult?.chatThread?.id;

```

From [README.md](https://cdn.jsdelivr.net/npm/@azure/communication-chat@1.6.0/README.md) · [Find projects using Azure Communication Chat →](https://dashboard.exa.ai/playground/search?q=%40azure/communication-chat%20GitHub%20projects)

### TalkJS

[npm](https://www.npmjs.com/package/talkjs) · [Docs](https://talkjs.com/docs/)

Provides a chat API with a pre-built, customizable chat UI.

- Downloads / mo: 223.4K
- Last release: 0.46.0
- License: TalkJS proprietary license
- Capabilities: [From the TalkJS docs](https://talkjs.com/docs/)

**Watch out for**

- **Browser package only.** React Native apps use the separate @talkjs/react-native package.

```sh
npm install talkjs
```

**Quickstart**

```typescript
import Talk from "talkjs";
await Talk.ready;
const session = new Talk.Session({ appId: "<APP_ID>", userId: "sample_user_alice" });
const chatbox = session.createChatbox();
chatbox.select("<CONVERSATION_ID>");
chatbox.mount(document.getElementById("talkjs-container"));

```

From [README.md](https://cdn.jsdelivr.net/npm/talkjs@0.46.0/README.md) · [Find projects using TalkJS →](https://dashboard.exa.ai/playground/search?q=talkjs%20GitHub%20projects)

## FAQ

### Which JavaScript chat library should I use?

[Stream Chat](#stream-chat), [Sendbird Chat](#sendbird-chat), [Ably Chat](#ably-chat), and [TalkJS](#talkjs) connect to hosted chat services, and TalkJS also ships a pre-built chat UI. [Matrix JS SDK](#matrix-js-sdk) connects to the open Matrix protocol under an open source license.

### Stream vs Sendbird: which should I use?

Both are hosted chat services with proprietary SDK licenses and optional UI kits. Stream accepts a token provider that refreshes authentication, while Sendbird separates conversations into open channels and group channels.

### What is a good Sendbird alternative?

Stream Chat and Ably Chat follow the same hosted chat model, and TalkJS adds a pre-built UI. Matrix JS SDK connects to the open Matrix protocol instead of one vendor's service.

### How does the Twilio Conversations API work in JavaScript?

The [Twilio Conversations](#twilio-conversations) client takes an access token that a backend issues, then loads conversations and pages through their messages. Conversations can include chat, SMS, MMS, and WhatsApp participants.

### Does installing a chat SDK create a working chat service?

Stream’s SDK is an API client for its service. Sendbird initialization requires an application ID from its dashboard. Twilio requires a token passed to the client constructor.

### Can a Stream browser client generate its own production user token?

Tokens are signed with the API secret and created on the server. A client initialized with only the API key cannot mint a token.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript chat libraries Matrix Stream Sendbird Twilio Conversations code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
