mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
30698ed6d8
* Initial marketplace draft * Update language * Add logos to cards * Redesign cards * Update adapter-card.tsx * Update adapter-card.tsx * Migrate marketplace to adapters * Update meta.json * Split adapters into new three groups * Add iMessage * Move adapter docs to READMEs * Cleanup docs * Add more logos, implement shadcn ui components * Update adapters.json * Add Streamdown * Fetch vercel readmes from workspace * Update readme-content.tsx * Upgrade Streamdown * Update global.css * Update adapters.json * Update adapters.json * Add links to docs * List upcoming official adapters * Update adapters.json * Fix adapters links * Fix typo * Misc fixes * Update adapters.json * Update adapters.json * Migrate new info * Update pnpm-lock.yaml * Update adapter-card.tsx * Add postgres to adapters page * Update adapter-card.tsx * Migrate postgres docs * Add pg to valid README imports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Move feature matrices from docs to package READMEs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove packages tables from adapter/state docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Genericize adapter/state doc descriptions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: improve adapters page accessibility and empty state handling * Add custom adapter building section to SKILL.md * Use currentColor for GitHub, Linear, and Memory icons * Use GitHub API for README fetch, add heading to fallback state Use the GitHub REST API instead of raw.githubusercontent.com to automatically resolve the repo's default branch, so community adapters using master or other branch names work correctly. * Update adapters-grid.tsx --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
4.7 KiB
4.7 KiB
Chat SDK
A unified TypeScript SDK for building chat bots across Slack, Microsoft Teams, Google Chat, Discord, Telegram, GitHub, and Linear. Write your bot logic once, deploy everywhere.
Installation
npm install chat
Install adapters for your platforms:
npm install @chat-adapter/slack @chat-adapter/teams @chat-adapter/gchat @chat-adapter/discord @chat-adapter/telegram
Usage
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(),
});
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}`);
});
See the Getting Started guide for a full walkthrough.
Supported platforms
| Platform | Package | Mentions | Reactions | Cards | Modals | Streaming | DMs |
|---|---|---|---|---|---|---|---|
| Slack | @chat-adapter/slack |
Yes | Yes | Yes | Yes | Native | Yes |
| Microsoft Teams | @chat-adapter/teams |
Yes | Read-only | Yes | No | Post+Edit | Yes |
| Google Chat | @chat-adapter/gchat |
Yes | Yes | Yes | No | Post+Edit | Yes |
| Discord | @chat-adapter/discord |
Yes | Yes | Yes | No | Post+Edit | Yes |
| Telegram | @chat-adapter/telegram |
Yes | Yes | Partial | No | Post+Edit | Yes |
| GitHub | @chat-adapter/github |
Yes | Yes | No | No | No | No |
| Linear | @chat-adapter/linear |
Yes | Yes | No | No | No | No |
Features
- Event handlers — mentions, messages, reactions, button clicks, slash commands, modals
- AI streaming — stream LLM responses with native Slack streaming and post+edit fallback
- Cards — JSX-based interactive cards (Block Kit, Adaptive Cards, Google Chat Cards)
- Actions — handle button clicks and dropdown selections
- Modals — form dialogs with text inputs, dropdowns, and validation
- Slash commands — handle
/commandinvocations - Emoji — type-safe, cross-platform emoji with custom emoji support
- File uploads — send and receive file attachments
- Direct messages — initiate DMs programmatically
- Ephemeral messages — user-only visible messages with DM fallback
Packages
| Package | Description |
|---|---|
chat |
Core SDK with Chat class, types, JSX runtime, and utilities |
@chat-adapter/slack |
Slack adapter |
@chat-adapter/teams |
Teams adapter |
@chat-adapter/gchat |
Google Chat adapter |
@chat-adapter/discord |
Discord adapter |
@chat-adapter/telegram |
Telegram adapter |
@chat-adapter/github |
GitHub adapter |
@chat-adapter/linear |
Linear adapter |
@chat-adapter/state-redis |
Redis state adapter (production) |
@chat-adapter/state-ioredis |
ioredis state adapter (alternative) |
@chat-adapter/state-pg |
PostgreSQL state adapter (production) |
@chat-adapter/state-memory |
In-memory state adapter (development) |
AI coding agent support
If you use an AI coding agent like Claude Code, you can teach it about Chat SDK:
npx skills add vercel/chat
Documentation
Full documentation is available at chat-sdk.dev/docs.
Contributing
See CONTRIBUTING.md for development setup and the release process.
License
MIT