Skip to main content

Chat SDK

A unified TypeScript SDK for building chat bots across multiple platforms. Write your bot logic once, deploy everywhere.

Why Chat SDK?

Write Once, Deploy Everywhere

Build your bot logic once with a unified API. Deploy to Slack, Teams, Google Chat, Discord, Telegram, GitHub, and Linear without platform-specific code.

Type-Safe & Modern

Built with TypeScript for full type safety. Async/await throughout. IntelliSense for all platform features.

AI-Ready Streaming

Native support for streaming AI responses. Works with any LLM provider. Platform-native streaming on Slack, fallback post+edit on others.

Rich Interactive Components

JSX-based cards with buttons, modals, and forms. Automatically adapted to each platform’s native format (Block Kit, Adaptive Cards, etc).

Supported Platforms

Chat SDK supports 7 major chat platforms with a consistent API:
PlatformPackageMentionsReactionsCardsModalsStreamingDMs
Slack@chat-adapter/slackNative
Microsoft Teams@chat-adapter/teamsRead-onlyPost+Edit
Google Chat@chat-adapter/gchatPost+Edit
Discord@chat-adapter/discordPost+Edit
Telegram@chat-adapter/telegramPartialPost+Edit
GitHub@chat-adapter/github
Linear@chat-adapter/linear

Quick Example

import { Chat } from "chat";
import { createSlackAdapter } from "@chat-adapter/slack";
import { createRedisState } from "@chat-adapter/state-redis";

const bot = new Chat({
  userName: "mybot",
  adapters: {
    slack: createSlackAdapter(),
  },
  state: createRedisState(),
});

// Respond to @mentions
bot.onNewMention(async (thread, message) => {
  await thread.subscribe();
  await thread.post("Hello! I'm listening to this thread.");
});

// Handle all messages in subscribed threads
bot.onSubscribedMessage(async (thread, message) => {
  await thread.post(`You said: ${message.text}`);
});

Key Features

Getting Started

Install the SDK and create your first bot in minutes

Basic Usage

Learn core concepts: event handlers, threads, messages, and state management

Event Handlers

Respond to mentions, messages, reactions, button clicks, slash commands, and modals

AI Streaming

Stream LLM responses with native Slack streaming and automatic fallback for other platforms

Interactive Cards

Build rich UI with JSX cards, buttons, and form modals

Cross-Platform Emoji

Type-safe emoji that work consistently across all platforms

Architecture

Chat SDK uses a clean adapter pattern:
  • Core SDK (chat) - Platform-agnostic bot logic, types, and utilities
  • Adapters - Platform-specific implementations (Slack, Teams, etc)
  • State Adapters - Persistence layer for subscriptions and locking (Redis, in-memory)
The SDK uses mdast (Markdown AST) as the canonical message format. Each adapter converts to/from platform-specific formats automatically.

Installation

Get started with the installation guide or explore the core concepts in the usage guide.