Loading...
Loading...
Vercel Chat SDK expert guidance. Use when building multi-platform chat bots — Slack, Telegram, Microsoft Teams, Discord, Google Chat, GitHub, Linear — with a single codebase. Covers the Chat class, adapters, threads, messages, cards, modals, streaming, state management, and webhook setup.
npx skill4agent add vercel/vercel-plugin chat-sdknode_modulesnode_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 guidesnode_modules/chat/docs/getting-started.mdxnode_modules/chat/docs/usage.mdxChatnode_modules/chat/docs/handling-events.mdxnode_modules/chat/docs/threads-messages-channels.mdxnode_modules/chat/docs/posting-messages.mdxnode_modules/chat/docs/streaming.mdxnode_modules/chat/docs/cards.mdxnode_modules/chat/docs/actions.mdxnode_modules/chat/docs/modals.mdxnode_modules/chat/docs/slash-commands.mdxnode_modules/chat/docs/direct-messages.mdxopenDM()node_modules/chat/docs/files.mdxnode_modules/chat/docs/state.mdxnode_modules/chat/docs/adapters.mdxnode_modules/chat/docs/api/chat.mdxChatnode_modules/chat/docs/api/thread.mdxThreadnode_modules/chat/docs/api/message.mdxMessagenode_modules/chat/docs/api/modals.mdxdist/index.d.tsnode_modulesimport { 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}`);
});post()stream()subscribe()setState()startTyping()textformattedraw| Handler | Trigger |
|---|---|
| Bot @-mentioned in an unsubscribed thread |
| New DM in an unsubscribed DM thread |
| Any message in a subscribed thread |
| Regex match in an unsubscribed thread |
| Emoji added or removed |
| Button clicks and select/radio interactions |
| Modal form submitted |
| Modal dismissed/cancelled |
| Slash command invocation |
| Slack assistant thread opened |
| Slack assistant context changed |
| Slack App Home opened |
| Slack member joined channel event |
node_modules/chat/docs/handling-events.mdxnode_modules/chat/docs/actions.mdxnode_modules/chat/docs/modals.mdxnode_modules/chat/docs/slash-commands.mdxonDirectMessagenode_modules/chat/docs/direct-messages.mdxAsyncIterable<string>thread.post()thread.stream()result.fullStreamresult.textStreamimport { 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);
});streamingUpdateIntervalMsfallbackStreamingPlaceholderText"..."nullStreamChunkjsxImportSource: "chat"tsconfig.jsonCardCardTextSectionFieldsFieldButtonCardLinkLinkButtonActionsSelectSelectOptionRadioSelectTableImageDividerModalTextInputSelectSelectOptionRadioSelectawait 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>
);| Platform | Package | Factory |
|---|---|---|
| Slack | | |
| Microsoft Teams | | |
| Google Chat | | |
| Discord | | |
| GitHub | | |
| Linear | | |
| Telegram | | |
| WhatsApp Business Cloud | | |
| State backend | Package | Factory |
|---|---|---|
| Redis | | |
| ioredis | | |
| PostgreSQL | | |
| Memory | | |
chat-state-cloudflare-do@beeper/chat-adapter-matrixchat-adapter-imessage@bitbasti/chat-adapter-webex@resend/chat-sdk-adapterchat-adapter-baileysnode_modules/chat/docs/contributing/building.mdxnode_modules/chat/docs/contributing/testing.mdxnode_modules/chat/docs/contributing/publishing.mdxnode_modules/chat/dist/index.d.tsAdapternode_modules/@chat-adapter/shared/dist/index.d.tsdist/index.d.tsBaseFormatConverterchat@chat-adapter/sharedbot.webhooks.<name>node_modules/chat/docs/guides/slack-nextjs.mdxnode_modules/chat/docs/guides/discord-nuxt.mdx