For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.
Skip to content
JavaScript logo

TalkJS

JavaScript chat library and API for real-time messaging

TalkJS is a JavaScript chat library with a pre-built chat UI and a hosted chat API. Install two npm packages, sync your users, and add a chatbox to any page. TalkJS stores the messages, delivers them in real time, and notifies users who are offline, so you don't have to build or run a chat server.

JavaScript SDK

Connect your users with 1-on-1 chat, group chat, or chatrooms using our real-time messaging infrastructure and pre-built UI.

Ship faster

Build chat without the heavy lifting. Transform your app into a full messaging experience and get started in minutes, not months.

Fully-featured

All the essential messaging features you need. Replies, mentions, typing indicators, link previews, emojis, and more.

Classtime
Decathlon
Riot Games
Hyundai

Ship faster

TalkJS is a developer friendly chat API with a pre-built UI that is highly customizable. You can build a chat feature in minutes instead of months.

We make it effortless to build:

  • 1-on-1 chat
  • Group chat
  • AI agents
  • GDPR-compliant
  • In-app comments
  • Livestream chat
  • Pretty much any use case

Add chat with a few lines of JavaScript

TalkJS Web Components are custom HTML elements: <t-chatbox> for one conversation, <t-inbox> for a full inbox, and <t-conversation-list> for a list of chats. They work with any framework, or with none. The JavaScript Data API (@talkjs/core) creates your users and conversations and keeps them in sync with TalkJS.

You can restyle the chat with CSS, or replace any part of the UI with your own theme components. See customization.

If your app already uses the Classic JavaScript SDK (Talk.Session, createInbox), its Classic SDK docs are still there. For new projects, use the Web Components.

// npm install @talkjs/web-components @talkjs/core
import "@talkjs/web-components";
import "@talkjs/web-components/default.css";
import { getTalkSession } from "@talkjs/core";

// Connect as the current user, and sync both users
const session = getTalkSession({
    appId: "YOUR_APP_ID",
    userId: "frank",
});
session.currentUser.createIfNotExists({ name: "Frank" });
session.user("nina").createIfNotExists({ name: "Nina" });

// Create a conversation between them
const conversation = session.conversation("frank_and_nina");
conversation.createIfNotExists();
conversation.participant("nina").createIfNotExists();

// Then show the chat anywhere in your HTML:
// <t-chatbox app-id="YOUR_APP_ID" user-id="frank"
//   conversation-id="frank_and_nina"
//   style="width: 400px; height: 600px;"></t-chatbox>
Scalable infrastructure REST API diagram

Fast and reliable
Never lose a message

There’s chat, and there’s great chat. TalkJS makes your user communication features reliable, fast, user-friendly, secure, and scalable.

Our REST Chat API and Webhooks let you hook TalkJS up to your backend in any way you see fit. Make an AI agent, record analytics, integrate TalkJS with a custom backend—anything you want.

WebSockets, Socket.IO or a chat library?

Many JavaScript chat tutorials build a chat room with WebSockets or Socket.IO. That's a good way to learn how real-time messaging works, and it's enough for a demo. A chat feature that your users rely on needs more than a socket connection.

What you build yourself on top of Socket.IO

  • A database for every message, and loading older messages as users scroll back.
  • Delivery to users who were offline. By default Socket.IO delivers each event at most once, and a client that was disconnected doesn't receive the events it missed. Its docs say stronger delivery guarantees must be built in your application.
  • Email, SMS or push notifications for messages that arrive while someone is away.
  • Read receipts, typing indicators and file uploads.
  • Moderation, such as blocked words, user reports and bans.
  • The chat UI itself, on desktop and mobile.

What TalkJS gives you

  • A hosted chat API that stores every message, with unlimited message history on every plan.
  • Real-time delivery, and users who reconnect see every message they missed. Users who are away get email, SMS or mobile push notifications.
  • Read receipts, typing indicators, file sharing and voice messages, built in.
  • Word blocklists and hiding contact details work without code. For reports and bans, you add a custom action button and call the REST API.
  • A pre-built UI from our chat SDK, which you can theme to match your app.

An AI coding agent can write the socket code for you, but everything in that first list is still yours to build, run and maintain.

Building it yourself is the better fit for a learning project or a short-lived chat room, or when you want to run every part of the stack yourself at no license cost. Another self-hosted route is XMPP, with the open-source Converse.js client and a server such as Prosody or ejabberd that you run.

TalkJS is a paid service once you go live, priced per monthly active user, with unlimited conversations and messages on every plan. If you're comparing hosted chat APIs, see TalkJS vs Stream, TalkJS vs Sendbird, TalkJS vs CometChat, and TalkJS vs PubNub, or see all comparisons.

All languages, all frameworks

TalkJS works with React, Angular, Vue, Svelte, Next.js, TypeScript and plain old jQuery. Most of your TalkJS code lives in the frontend, so it works with any backend, including Node.js, PHP, Laravel, Ruby on Rails, Django and ASP.NET.

Node.js logoNext.js logoPHP logoDjango logojQuery logoIonic logoLaravel logoFlutter logo

FAQs

A JavaScript chat library is code you add to a web app to send and show chat messages. Some, like Socket.IO, only move messages between browsers and your server. Others, like TalkJS, come with a hosted backend and a ready-made chat UI.

Yes. Load the Web Components from a CDN with a script tag, and you need no build step.

No. TalkJS runs the chat servers. Your server only signs a token (a JWT) for each user, so that nobody else can open their chats.

Yes. React has its own TalkJS components, and the other frameworks use the Web Components. In Node.js you can use the JavaScript Data API or the REST API.

Yes. Every plan includes a free development mode with no time limit, and you only pay when you go live. Paid plans start at $239 per month billed annually ($279 billed monthly), with 10,000 monthly active users included.