
Chat SDK
OfficialFreeBuild multi-platform chat bots with ease.
Free · Opens the source repo
What Chat SDK does
Chat SDK is a unified TypeScript SDK designed for developers looking to create chat bots that can operate across multiple platforms, including Slack, Microsoft Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp. With this SDK, developers can write their bot logic once and deploy it everywhere, simplifying the development process and ensuring consistency across different messaging environments. The SDK provides a robust set of features for handling various interactions such as mentions, direct messages, and slash commands, making it a versatile tool for modern chat applications.
The core of Chat SDK is the Chat class, which serves as the main entry point for bot development. It coordinates the adapters for different platforms, manages the state, and handles event routing. Developers can create platform-specific adapters using the provided factory functions, enabling seamless integration with the chat services they wish to support. Additionally, the SDK includes state adapters that help maintain the bot's state across sessions, ensuring that conversations can continue smoothly.
For those looking to create rich user experiences, Chat SDK supports the posting of rich cards and modals using JSX. This allows developers to create interactive elements that enhance user engagement. The SDK also provides a comprehensive set of event handlers that respond to various triggers, such as new messages, reactions, and modal submissions, enabling developers to create dynamic and responsive chat bots.
In summary, Chat SDK is an essential tool for developers aiming to build sophisticated chat bots that can interact across multiple platforms. It streamlines the development process and provides the necessary tools to create engaging and functional chat experiences.
When to use it
Use Chat SDK when you need to develop a chat bot that interacts with users across various messaging platforms without duplicating code.
When not to use it
This SDK may not be suitable for projects that require highly specialized features unique to a single platform, as it focuses on cross-platform compatibility.
What you can build with it
Creating a Slack Bot
Develop a bot for Slack that listens for mentions and responds to user queries in real-time.
Cross-Platform Bot Development
Build a single bot that can operate on multiple platforms like Discord and Telegram, reducing the need for separate codebases.
Integrating AI Responses
Utilize the streaming capabilities of Chat SDK to send AI-generated responses to users in chat threads.
How to install Chat SDK
View source1. Install with the skills CLI
npx skills add vercel-labs/open-agents/chat-sdk --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by vercel-labsChat SDK
Unified TypeScript SDK for building chat bots across Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp. Write bot logic once, deploy everywhere.
Start with published sources
When Chat SDK is installed in a user project, inspect the published files that ship in node_modules:
node_modules/chat/docs/ # bundled docs
node_modules/chat/dist/index.d.ts # core API types
node_modules/chat/dist/jsx-runtime.d.ts # JSX runtime types
node_modules/chat/docs/contributing/ # adapter-authoring docs
node_modules/chat/docs/guides/ # framework/platform guides
If one of the paths below does not exist, that package is not installed in the project yet.
Read these before writing code:
node_modules/chat/docs/getting-started.mdx— install and setupnode_modules/chat/docs/usage.mdx—Chatconfig and lifecyclenode_modules/chat/docs/handling-events.mdx— event routing and handlersnode_modules/chat/docs/threads-messages-channels.mdx— thread/channel/message modelnode_modules/chat/docs/posting-messages.mdx— post, edit, delete, schedulenode_modules/chat/docs/streaming.mdx— AI SDK integration and streaming semanticsnode_modules/chat/docs/cards.mdx— JSX cardsnode_modules/chat/docs/actions.mdx— button/select interactionsnode_modules/chat/docs/modals.mdx— modal submit/close flowsnode_modules/chat/docs/slash-commands.mdx— slash command routingnode_modules/chat/docs/direct-messages.mdx— DM behavior andopenDM()node_modules/chat/docs/files.mdx— attachments/uploadsnode_modules/chat/docs/state.mdx— persistence, locking, dedupenode_modules/chat/docs/adapters.mdx— cross-platform feature matrixnode_modules/chat/docs/api/chat.mdx— exactChatAPInode_modules/chat/docs/api/thread.mdx— exactThreadAPInode_modules/chat/docs/api/message.mdx— exactMessageAPInode_modules/chat/docs/api/modals.mdx— modal element and event details
For the specific adapter or state package you are using, inspect that installed package's dist/index.d.ts export surface in node_modules.
Quick start
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(),
dedupeTtlMs: 600_000,
});
bot.onNewMention(async (thread) => {
await thread.subscribe();
await thread.post("Hello! I'm listening to this thread.");
});
bot.onSubscribedMessage(async (thread, message) => {
await thread.post(`You said: ${message.text}`);
});
Core concepts
- Chat — main entry point; coordinates adapters, routing, locks, and state
- Adapters — platform-specific integrations for Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp
- State adapters — persistence for subscriptions, locks, dedupe, and thread state
- Thread — conversation context with
post(),stream(),subscribe(),setState(),startTyping() - Message — normalized content with
text,formatted, attachments, author info, and platformraw - Channel — container for threads and top-level posts
Event handlers
| Handler | Trigger |
|---|---|
onNewMention | Bot @-mentioned in an unsubscribed thread |
onDirectMessage | New DM in an unsubscribed DM thread |
onSubscribedMessage | Any message in a subscribed thread |
onNewMessage(regex) | Regex match in an unsubscribed thread |
onReaction(emojis?) | Emoji added or removed |
onAction(actionIds?) | Button clicks and select/radio interactions |
onModalSubmit(callbackId?) | Modal form submitted |
onModalClose(callbackId?) | Modal dismissed/cancelled |
onSlashCommand(commands?) | Slash command invocation |
onAssistantThreadStarted | Slack assistant thread opened |
onAssistantContextChanged | Slack assistant context changed |
onAppHomeOpened | Slack App Home opened |
onMemberJoinedChannel | Slack member joined channel event |
Read node_modules/chat/docs/handling-events.mdx, node_modules/chat/docs/actions.mdx, node_modules/chat/docs/modals.mdx, and node_modules/chat/docs/slash-commands.mdx before wiring handlers. onDirectMessage behavior is documented in node_modules/chat/docs/direct-messages.mdx.
Streaming
Pass any AsyncIterable<string> to thread.post() or thread.stream(). For AI SDK, prefer result.fullStream over result.textStream when available so step boundaries are preserved.
import { ToolLoopAgent } from "ai";
const agent = new ToolLoopAgent({ model: "anthropic/claude-4.5-sonnet" });
bot.onNewMention(async (thread, message) => {
const result = await agent.stream({ prompt: message.text });
await thread.post(result.fullStream);
});
Key details:
streamingUpdateIntervalMscontrols post+edit fallback cadencefallbackStreamingPlaceholderTextdefaults to"..."; setnullto disable- Structured
StreamChunksupport is Slack-only; other adapters ignore non-text chunks
Cards and modals (JSX)
Set jsxImportSource: "chat" in tsconfig.json.
Card components:
Card,CardText,Section,Fields,Field,Button,CardLink,LinkButton,Actions,Select,SelectOption,RadioSelect,Table,Image,Divider
Modal components:
Modal,TextInput,Select,SelectOption,RadioSelect
await thread.post(
<Card title="Order #1234">
<CardText>Your order has been received.</CardText>
<Actions>
<Button id="approve" style="primary">Approve</Button>
<Button id="reject" style="danger">Reject</Button>
</Actions>
</Card>
);
Adapter inventory
Official platform adapters
| Platform | Package | Factory |
|---|---|---|
| Slack | @chat-adapter/slack | createSlackAdapter |
| Microsoft Teams | @chat-adapter/teams | createTeamsAdapter |
| Google Chat | @chat-adapter/gchat | createGoogleChatAdapter |
| Discord | @chat-adapter/discord | createDiscordAdapter |
| GitHub | @chat-adapter/github | createGitHubAdapter |
| Linear | @chat-adapter/linear | createLinearAdapter |
| Telegram | @chat-adapter/telegram | createTelegramAdapter |
| WhatsApp Business Cloud | @chat-adapter/whatsapp | createWhatsAppAdapter |
Official state adapters
| State backend | Package | Factory |
|---|---|---|
| Redis | @chat-adapter/state-redis | createRedisState |
| ioredis | @chat-adapter/state-ioredis | createIoRedisState |
| PostgreSQL | @chat-adapter/state-pg | createPostgresState |
| Memory | @chat-adapter/state-memory | createMemoryState |
Community adapters
chat-state-cloudflare-do@beeper/chat-adapter-matrixchat-adapter-imessage@bitbasti/chat-adapter-webex@resend/chat-sdk-adapterchat-adapter-baileys
Coming-soon platform entries
- Signal
- X
- Messenger
Building a custom adapter
Read these published docs first:
node_modules/chat/docs/contributing/building.mdxnode_modules/chat/docs/contributing/testing.mdxnode_modules/chat/docs/contributing/publishing.mdx
Also inspect:
node_modules/chat/dist/index.d.ts—Adapterand related interfacesnode_modules/@chat-adapter/shared/dist/index.d.ts— shared errors and utilities- Installed official adapter
dist/index.d.tsfiles — reference implementations for config and APIs
A custom adapter needs request verification, webhook parsing, message/thread/channel operations, ID encoding/decoding, and a format converter. Use BaseFormatConverter from chat and shared utilities from @chat-adapter/shared.
Webhook setup
Each registered adapter exposes bot.webhooks.<name>. Wire those directly to your HTTP framework routes. See node_modules/chat/docs/guides/slack-nextjs.mdx and node_modules/chat/docs/guides/discord-nuxt.mdx for framework-specific route patterns.
Frequently asked questions about Chat SDK
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
