Loading...
Loading...
Build multi-platform chat bots with Chat SDK (`chat` npm package). Use when developers want to (1) Build a Slack, Teams, Google Chat, Discord, GitHub, or Linear bot, (2) Use the Chat SDK to handle mentions, messages, reactions, slash commands, cards, modals, or streaming, (3) Set up webhook handlers for chat platforms, (4) Send interactive cards or stream AI responses to chat platforms. Triggers on "chat sdk", "chat bot", "slack bot", "teams bot", "discord bot", "@chat-adapter", building bots that work across multiple chat platforms.
npx skill4agent add vercel/chat chat-sdkchatnode_modules/chat/docs/node_modules/chat/docs/ # Full documentation (MDX files)
node_modules/chat/dist/ # Built types (.d.ts files)docs/getting-started.mdxdocs/usage.mdxdocs/streaming.mdxdocs/cards.mdxdocs/actions.mdxdocs/modals.mdxdocs/adapters/*.mdxdocs/state/*.mdxnode_modules/chat/dist/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({
botToken: process.env.SLACK_BOT_TOKEN!,
signingSecret: process.env.SLACK_SIGNING_SECRET!,
}),
},
state: createRedisState({ url: process.env.REDIS_URL! }),
});
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()subscribe()startTyping()textformattedraw| Handler | Trigger |
|---|---|
| Bot @-mentioned in unsubscribed thread |
| Any message in subscribed thread |
| Messages matching pattern in unsubscribed threads |
| Slash command invocations |
| Emoji reactions added/removed |
| Button clicks and dropdown selections |
| Slack Assistants API thread opened |
| Slack App Home tab opened |
AsyncIterable<string>thread.post()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.textStream);
});jsxImportSource: "chat"CardCardTextButtonActionsFieldsFieldSelectSelectOptionImageDividerLinkButtonSectionRadioSelectawait 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>
);| Package | Purpose |
|---|---|
| Core SDK |
| Slack |
| Microsoft Teams |
| Google Chat |
| Discord |
| GitHub Issues |
| Linear Issues |
| Redis state (production) |
| ioredis state (alternative) |
| In-memory state (development) |
bot.webhooks.{platform}