Chat SDK
Chat SDK is now open source and in beta
A unified TypeScript SDK for building chat bots across Slack, Microsoft Teams, Google Chat, Discord, and more. Write your bot logic once, deploy everywhere.
Event-driven by design
See how your handlers respond to real-time chat events across any platform.
bot.onNewMention(async (thread) => { await thread.subscribe(); await thread.post("Sure! Here's a quick summary...");});
bot.onReaction(async (thread, reaction) => { await thread.post(`Thanks for the ${reaction.emoji}!`);});
bot.onSubscribedMessage(async (thread, msg) => { await thread.post("Checking now...");});
Multi-platform
Deploy to Slack, Teams, Google Chat, Discord, GitHub, and Linear from a single codebase.
Type-safe
Full TypeScript support with type-safe adapters, event handlers, and JSX cards.
AI streaming
First-class support for streaming LLM responses with native platform rendering.
Usage
Install the SDK and pair it with your favorite adapters and state management solutions.
import { Chat } from "chat";import { createSlackAdapter } from "@chat-adapter/slack";import { createRedisState } from "@chat-adapter/state-redis";
export const bot = new Chat({ userName: "mybot", adapters: { slack: createSlackAdapter(), }, state: createRedisState(),});
// Respond when someone @mentions the botbot.onNewMention(async (thread) => { await thread.subscribe(); await thread.post("Hello! I'm listening to this thread now.");});
// Respond to follow-up messages in subscribed threadsbot.onSubscribedMessage(async (thread, message) => { await thread.post(`You said: ${ message.text }`);});Guides
Step-by-step guides to help you build common patterns with the Chat SDK.
Slack bot with Next.js
Build a Slack bot from scratch using Chat SDK, Next.js, and Redis.
const bot = new Chat({ userName: "my-bot", adapters: { slack: createSlackAdapter(), }, state: createRedisState(),});Discord support bot with Nuxt
Build a Discord support bot using Chat SDK, Nuxt, and AI SDK.
bot.onNewMention(async (thread) => { await thread.subscribe(); await thread.post( <Card title="Support"> <Text>Ask your question and I'll do my best to answer.</Text> <Actions> <Button id="escalate"> Escalate to Human </Button> </Actions> </Card> );});Code review bot with Hono
Build a GitHub bot that reviews pull requests using AI SDK and Vercel Sandbox.
const sandbox = await Sandbox.create({ source: { type: "git", url: `https://github.com/${owner}/${repo}`, username: "x-access-token", password: process.env.GITHUB_TOKEN, },});
const { tools } = await createBashTool({ sandbox,});