Usage
Creating a Chat InstanceThreads, Messages, and ChannelsHandling EventsPosting MessagesAdapters
Platform AdaptersState AdaptersFeatures
Overlapping MessagesActionsCardsDirect messagesEmojiEphemeral messagesFile uploadsModalsSlash CommandsStreamingError handlingAPI Reference
OverviewChatThreadChannelMessagePostableMessageCardsMarkdownModalsContributing
Building a community adapterTesting adaptersDocumenting your adapterPublishing your adapterA unified TypeScript SDK for building chat bots with type-safe handlers, JSX cards, and multi-platform support—powered by Vercel
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...");});
The open-source chat toolkit designed to help developers build chat bots that run on Slack, Teams, Google Chat, Discord, WhatsApp, and more.
Multi-platform support.
Ship to every chat platform from one codebase.
Event-driven by design.
React to mentions, reactions, and replies.
Type-safe by default.
Strict types for adapters, handlers, and JSX cards.
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 }`);});A unified API for building event-driven chat bots. Listen for mentions, subscribe to threads, and post rich cards across multiple platforms.
Supports
Plug Chat SDK into an entire ecosystem designed for AI-native chat experiences that scale.
Get started by exploring the docs, following a guide, or using a template.
Stream agent responses and tool calls into Slack threads.
bot.onNewMention(async (thread, msg) => { await thread.subscribe(); const result = await agent.stream({ prompt: msg.text, }); await thread.post(result.fullStream);});Answer questions from synced docs and repos with file-system search.
const savoir = createSavoir({ apiUrl: process.env.SAVOIR_URL, apiKey: process.env.SAVOIR_API_KEY,});
const { text } = await generateText({ model, tools: savoir.tools, maxSteps: 10, prompt: "How do I configure auth?",});Review pull requests with sandboxed AI analysis on GitHub.
bot.onNewMention(async (thread, msg) => { const { data: pr } = await octokit.pulls.get({ owner, repo, pull_number, }); await thread.post("Starting code review..."); const review = await reviewPullRequest({ owner, repo, prBranch: pr.head.ref, }); await thread.post(review);});