{"id":27048,"plugin_id":"plugin_connector_690a90ec05c881918afb6a55dc9bbaa1","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-10-06T18:03:10.489Z","digest":"2eb1249b0215caf31b42ac62ed3ca7b63b4fa912e43f644b1cd61ae19764ce38","against":24833,"payload":{"description":"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.","included_files":[{"relative_path":"agents/openai.yaml","size_in_bytes":93}],"name":"chat-sdk","skill_md_contents":"---\nname: chat-sdk\ndescription: 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.\nmetadata:\n  priority: 8\n  docs:\n    - \"https://chat-sdk.dev/docs\"\n    - \"https://vercel.com/kb/chat-sdk\"\n  sitemap: \"https://chat-sdk.dev/sitemap.xml\"\n  pathPatterns:\n    - \"app/api/chat/**\"\n    - \"app/api/chat-bot/**\"\n    - \"app/api/bot/**\"\n    - \"app/api/slack/**\"\n    - \"app/api/teams/**\"\n    - \"app/api/discord/**\"\n    - \"app/api/gchat/**\"\n    - \"app/api/telegram/**\"\n    - \"app/api/github-bot/**\"\n    - \"app/api/linear-bot/**\"\n    - \"app/api/webhooks/slack/**\"\n    - \"app/api/webhooks/teams/**\"\n    - \"app/api/webhooks/discord/**\"\n    - \"app/api/webhooks/gchat/**\"\n    - \"app/api/webhooks/telegram/**\"\n    - \"app/api/webhooks/github/**\"\n    - \"app/api/webhooks/linear/**\"\n    - \"src/app/api/chat/**\"\n    - \"src/app/api/chat-bot/**\"\n    - \"src/app/api/bot/**\"\n    - \"src/app/api/slack/**\"\n    - \"src/app/api/teams/**\"\n    - \"src/app/api/discord/**\"\n    - \"src/app/api/gchat/**\"\n    - \"src/app/api/telegram/**\"\n    - \"lib/bot.*\"\n    - \"lib/bot/**\"\n    - \"src/lib/bot.*\"\n    - \"src/lib/bot/**\"\n    - \"lib/chat-bot/**\"\n    - \"src/lib/chat-bot/**\"\n    - \"bot/**\"\n    - \"pages/api/bot.*\"\n    - \"pages/api/bot/**\"\n    - \"src/pages/api/bot.*\"\n    - \"src/pages/api/bot/**\"\n    - \"tests/**/bot*\"\n    - \"test/**/bot*\"\n    - \"fixtures/replay/**\"\n    - \"apps/*/app/api/bot/**\"\n    - \"apps/*/app/api/slack/**\"\n    - \"apps/*/app/api/teams/**\"\n    - \"apps/*/app/api/discord/**\"\n    - \"apps/*/lib/bot/**\"\n    - \"apps/*/src/lib/bot/**\"\n  importPatterns:\n    - \"chat\"\n    - \"@chat-adapter/*\"\n  bashPatterns:\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\byarn\\s+add\\s+[^\\n]*\\bchat\\b'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\byarn\\s+add\\s+[^\\n]*@chat-adapter/'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\byarn\\s+add\\s+[^\\n]*@chat-adapter/telegram'\n  promptSignals:\n    phrases:\n      - \"chat sdk\"\n      - \"chat bot\"\n      - \"chatbot\"\n      - \"conversational interface\"\n      - \"slack bot\"\n      - \"telegram bot\"\n      - \"discord bot\"\n      - \"teams bot\"\n    allOf:\n      - [bot, platform]\n      - [bot, multi]\n    anyOf:\n      - \"onNewMention\"\n      - \"onSubscribedMessage\"\n      - \"chat adapter\"\n      - \"cross-platform bot\"\n    noneOf:\n      - \"useChat\"\n    minScore: 6\nretrieval:\n  aliases:\n    - chat ui\n    - chatbot\n    - conversation interface\n    - messaging component\n  intents:\n    - build chatbot\n    - add chat interface\n    - create messaging ui\n    - implement chat feature\n  entities:\n    - useChat\n    - Message\n    - ChatUI\n    - StreamingMessage\n    - chat-sdk\n  examples:\n    - build a chatbot interface\n    - add chat to my app\n    - create a messaging component\nchainTo:\n  -\n    pattern: 'from\\s+[''\"\"]openai[''\"\"]'\n    targetSkill: ai-sdk\n    message: 'Direct OpenAI SDK import in chat bot — loading AI SDK guidance for unified provider abstraction and streaming.'\n  -\n    pattern: 'from\\s+[''\\\"](slack-bolt|@slack/bolt|@slack/web-api)[''\"]|require\\s*\\(\\s*[''\\\"](slack-bolt|@slack/bolt|@slack/web-api)[''\"]|new\\s+App\\s*\\(\\s*\\{\\s*token'\n    targetSkill: chat-sdk\n    message: '@slack/bolt or @slack/web-api detected — use the Chat SDK with @chat-adapter/slack instead for a unified multi-platform bot that works across Slack, Teams, Discord, Telegram, and more.'\n  -\n    pattern: 'from\\s+[''\\\"](discord\\.js|discord-api-types|telegram-bot-api|telegraf|grammy)[''\"]|require\\s*\\(\\s*[''\\\"](discord\\.js|telegraf|grammy)[''\"]'\n    targetSkill: chat-sdk\n    message: 'Platform-specific bot library detected — use the Chat SDK with the corresponding @chat-adapter/* package for a unified multi-platform bot codebase.'\n  -\n    pattern: 'setTimeout\\s*\\(|setInterval\\s*\\(|while\\s*\\(\\s*true'\n    targetSkill: workflow\n    message: 'Long-running or polling logic in chat bot — loading Workflow SDK for durable execution that survives deploys.'\n    skipIfFileContains: 'use workflow|from\\s+[''\"]workflow[''\"]'\n  -\n    pattern: 'process\\.env\\.(OPENAI_API_KEY|ANTHROPIC_API_KEY)|from\\s+[''\"]@ai-sdk/(anthropic|openai)[''\"\"]'\n    targetSkill: ai-gateway\n    message: 'Direct provider API key in chat bot — loading AI Gateway guidance for OIDC auth and model routing.'\n    skipIfFileContains: 'gateway\\(|@ai-sdk/gateway'\n---\n\n# Chat SDK\n\nUnified TypeScript SDK for building chat bots across Slack, Microsoft Teams, Google Chat, Discord, Telegram, GitHub, Linear, WhatsApp, and more. Write your bot logic once, deploy everywhere.\n\n## Scaffold a new project\n\nUse `create-chat-sdk` to scaffold a basic Next.js bot project without prompts. Run `npx create-chat-sdk --help` to see the available options and how the CLI works.\n\n## Start with Chat SDK documentation\n\nWhen Chat SDK is installed in a user's project, inspect the published docs that ship in `node_modules/chat/docs/`, the resources in `node_modules/chat/resources/`, and the available open source templates in `node_modules/chat/resources/templates.json`.\n\nIf those paths do not exist, the `chat` package is not installed in the project yet. The user can install it with `npm i chat`.\n\nYou can also find the docs on the [Chat SDK website](https://chat-sdk.dev/docs) and in the [Vercel knowledge base](https://vercel.com/kb/chat-sdk).\n\n## Available resources\n\n<!-- RESOURCES:START -->\n\n### Guides\n\n- `node_modules/chat/resources/guides/how-to-build-an-ai-agent-for-slack-with-chat-sdk-and-ai-sdk.md` — Build a Slack AI agent using Chat SDK, AI SDK's ToolLoopAgent, and Vercel AI Gateway. Covers project setup, tool definitions, streaming responses, deployment to Vercel, and scaling tool selection with toolpick.\n- `node_modules/chat/resources/guides/human-in-the-loop-with-chat-sdk-and-workflow-sdk.md` — Pause durable workflows on Slack approval cards using Chat SDK and Workflow SDK. Uses createWebhook to suspend workflows until a button click, with patterns for multi-stage approvals, timeouts via durable sleep, and approver validation.\n- `node_modules/chat/resources/guides/liveblocks-chat-sdk-ai-sdk.md` — Build an AI agent that replies to @-mentions in Liveblocks comment threads with streamed responses and tool calling. Uses Chat SDK, the Liveblocks adapter, AI SDK's ToolLoopAgent, and Redis for thread subscriptions and distributed locking.\n- `node_modules/chat/resources/guides/slack-bot-vercel-blob.md` — Build a Slack bot that lists, reads, uploads, and deletes files in Vercel Blob through tool calls. Uses Chat SDK, AI SDK's ToolLoopAgent, and Files SDK's createFileTools factory with approval-gated write tools and a read-only mode.\n- `node_modules/chat/resources/guides/run-and-track-deploys-from-slack.md` — Build a Slack deploy bot with Chat SDK and Vercel Workflow. Dispatch GitHub Actions from a slash command, gate production behind approval, poll for completion, and notify Linear and GitHub when the run finishes.\n- `node_modules/chat/resources/guides/triage-form-submissions-with-chat-sdk.md` — Build a Slack bot that triages form submissions with interactive cards. Forward, edit, or mark as spam without leaving Slack. Built with Chat SDK, Hono, and Resend.\n- `node_modules/chat/resources/guides/how-to-build-a-slack-bot-with-next-js-and-redis.md` — This guide walks through building a Slack bot with Next.js, covering project setup, Slack app configuration, event handling, interactive features, and deployment.\n- `node_modules/chat/resources/guides/create-a-discord-support-bot-with-nuxt-and-redis.md` — This guide walks through building a Discord support bot with Nuxt, covering project setup, Discord app configuration, Gateway forwarding, AI-powered responses, and deployment.\n- `node_modules/chat/resources/guides/ship-a-github-code-review-bot-with-hono-and-redis.md` — This guide walks through building a GitHub bot that reviews pull requests on demand. When a user @mentions the bot on a PR, Chat SDK picks up the mention, spins up a Vercel Sandbox with the repo cloned, and uses AI SDK to analyze the diff.\n- `node_modules/chat/resources/guides/build-a-slack-bot-with-vercel-connect.md` — Learn how to build your very own Slackbot with Chat SDK and AI SDK. Vercel Connect supplies runtime Slack tokens and forwards triggers, so you never store a long-lived bot token.\n- `node_modules/chat/resources/guides/vercel-connect.md` — Use Vercel Connect to call provider APIs like Slack, GitHub, and Snowflake from your agents and services with short-lived, user-authorized tokens instead of long-lived secrets.\n- `node_modules/chat/resources/guides/ai-gateway-and-ai-sdk.md` — Build AI agents on Vercel with AI Gateway and AI SDK, then make them reliable, capable, and durable with Sandbox, Chat SDK, Vercel Connect, and Workflow.\n- `node_modules/chat/resources/guides/daily-digest-bot-with-chat-sdk-and-workflow-sdk.md` — Create your own daily digest bot that posts a daily digest of GitHub stats to Slack. Learn how to use Vercel Connect to set up Slack and GitHub app securely in your project.\n\n### Templates\n\nListed in `node_modules/chat/resources/templates.json`:\n\n- **Chat SDK Liveblocks Bot** — Build a bot that you can engage with inside Liveblocks. (https://vercel.com/templates/next.js/chat-sdk-liveblocks-bot)\n- **Durable iMessage Agent** — Durable iMessage agent powered by the Sendblue adapter. (https://vercel.com/templates/nitro/durable-imessage-ai-agent)\n- **Knowledge Agent** — Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base. (https://vercel.com/templates/nuxt/chat-sdk-knowledge-agent)\n- **Community Agent** — Open source AI-powered Slack community management bot with a built-in Next.js admin panel. Uses Chat SDK, AI SDK, and Vercel Workflow. (https://vercel.com/templates/next.js/chat-sdk-community-agent)\n- **Caltext** — iMessage calorie tracking assistant powered by AI. (https://vercel.com/templates/hono/caltext)\n\n<!-- RESOURCES:END -->\n\n## Chat SDK adapters\n\n### Adapter directory\n\nSee the 'Official Adapters', 'Vendor-Official Adapters', and 'Community Adapters' sections in the [Chat SDK llms.txt file](https://chat-sdk.dev/llms.txt) for the current list of official, vendor-official, and community adapters.\n\n### Adapter catalog subpath\n\nChat SDK exposes a zero-dependency static catalog at `chat/adapters`.\n\nAgents can import `ADAPTERS`, `ADAPTER_NAMES`, `getAdapter`, `isAdapterSlug`, `listEnvVars`, `getSecretEnvVars`, and metadata types like `CatalogAdapter` and `AdapterSlug` from this subpath without importing any adapter implementation package.\n\nUse it for:\n- Listing official and vendor-official adapter slugs, names, npm packages, groups, and platform vs state types.\n- Building setup or onboarding flows that need package names, peer dependencies, and install guidance before any adapter is installed.\n- Discovering required, optional, and credential-mode environment variables for an adapter, including which variables are secrets.\n- Keeping vendor-official adapter docs and metadata aligned with the catalog when adding or updating a listed adapter."},"changes":[{"path":"/skill_md_contents","type":"changed","before":"---\nname: chat-sdk\ndescription: 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.\nmetadata:\n  priority: 8\n  docs:\n    - \"https://sdk.vercel.ai/docs/ai-sdk-ui/chatbot\"\n    - \"https://github.com/vercel/ai-chatbot\"\n  sitemap: \"https://sdk.vercel.ai/sitemap.xml\"\n  pathPatterns:\n    - \"app/api/chat/**\"\n    - \"app/api/chat-bot/**\"\n    - \"app/api/bot/**\"\n    - \"app/api/slack/**\"\n    - \"app/api/teams/**\"\n    - \"app/api/discord/**\"\n    - \"app/api/gchat/**\"\n    - \"app/api/telegram/**\"\n    - \"app/api/github-bot/**\"\n    - \"app/api/linear-bot/**\"\n    - \"app/api/webhooks/slack/**\"\n    - \"app/api/webhooks/teams/**\"\n    - \"app/api/webhooks/discord/**\"\n    - \"app/api/webhooks/gchat/**\"\n    - \"app/api/webhooks/telegram/**\"\n    - \"app/api/webhooks/github/**\"\n    - \"app/api/webhooks/linear/**\"\n    - \"src/app/api/chat/**\"\n    - \"src/app/api/chat-bot/**\"\n    - \"src/app/api/bot/**\"\n    - \"src/app/api/slack/**\"\n    - \"src/app/api/teams/**\"\n    - \"src/app/api/discord/**\"\n    - \"src/app/api/gchat/**\"\n    - \"src/app/api/telegram/**\"\n    - \"lib/bot.*\"\n    - \"lib/bot/**\"\n    - \"src/lib/bot.*\"\n    - \"src/lib/bot/**\"\n    - \"lib/chat-bot/**\"\n    - \"src/lib/chat-bot/**\"\n    - \"bot/**\"\n    - \"pages/api/bot.*\"\n    - \"pages/api/bot/**\"\n    - \"src/pages/api/bot.*\"\n    - \"src/pages/api/bot/**\"\n    - \"tests/**/bot*\"\n    - \"test/**/bot*\"\n    - \"fixtures/replay/**\"\n    - \"apps/*/app/api/bot/**\"\n    - \"apps/*/app/api/slack/**\"\n    - \"apps/*/app/api/teams/**\"\n    - \"apps/*/app/api/discord/**\"\n    - \"apps/*/lib/bot/**\"\n    - \"apps/*/src/lib/bot/**\"\n  importPatterns:\n    - \"chat\"\n    - \"@chat-adapter/*\"\n  bashPatterns:\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\byarn\\s+add\\s+[^\\n]*\\bchat\\b'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\byarn\\s+add\\s+[^\\n]*@chat-adapter/'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\byarn\\s+add\\s+[^\\n]*@chat-adapter/telegram'\n  promptSignals:\n    phrases:\n      - \"chat sdk\"\n      - \"chat bot\"\n      - \"chatbot\"\n      - \"conversational interface\"\n      - \"slack bot\"\n      - \"telegram bot\"\n      - \"discord bot\"\n      - \"teams bot\"\n    allOf:\n      - [bot, platform]\n      - [bot, multi]\n    anyOf:\n      - \"onNewMention\"\n      - \"onSubscribedMessage\"\n      - \"chat adapter\"\n      - \"cross-platform bot\"\n    noneOf:\n      - \"useChat\"\n    minScore: 6\n---\n\n# Chat SDK\n\nUnified TypeScript SDK for building chat bots across Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp. Write bot logic once, deploy everywhere.\n\n## Start with published sources\n\nWhen Chat SDK is installed in a user project, inspect the published files that ship in `node_modules`:\n\n```\nnode_modules/chat/docs/                    # bundled docs\nnode_modules/chat/dist/index.d.ts          # core API types\nnode_modules/chat/dist/jsx-runtime.d.ts    # JSX runtime types\nnode_modules/chat/docs/contributing/       # adapter-authoring docs\nnode_modules/chat/docs/guides/             # framework/platform guides\n```\n\nIf one of the paths below does not exist, that package is not installed in the project yet.\n\nRead these before writing code:\n- `node_modules/chat/docs/getting-started.mdx` — install and setup\n- `node_modules/chat/docs/usage.mdx` — `Chat` config and lifecycle\n- `node_modules/chat/docs/handling-events.mdx` — event routing and handlers\n- `node_modules/chat/docs/threads-messages-channels.mdx` — thread/channel/message model\n- `node_modules/chat/docs/posting-messages.mdx` — post, edit, delete, schedule\n- `node_modules/chat/docs/streaming.mdx` — AI SDK integration and streaming semantics\n- `node_modules/chat/docs/cards.mdx` — JSX cards\n- `node_modules/chat/docs/actions.mdx` — button/select interactions\n- `node_modules/chat/docs/modals.mdx` — modal submit/close flows\n- `node_modules/chat/docs/slash-commands.mdx` — slash command routing\n- `node_modules/chat/docs/direct-messages.mdx` — DM behavior and `openDM()`\n- `node_modules/chat/docs/files.mdx` — attachments/uploads\n- `node_modules/chat/docs/state.mdx` — persistence, locking, dedupe\n- `node_modules/chat/docs/adapters.mdx` — cross-platform feature matrix\n- `node_modules/chat/docs/api/chat.mdx` — exact `Chat` API\n- `node_modules/chat/docs/api/thread.mdx` — exact `Thread` API\n- `node_modules/chat/docs/api/message.mdx` — exact `Message` API\n- `node_modules/chat/docs/api/modals.mdx` — modal element and event details\n\nFor the specific adapter or state package you are using, inspect that installed package's `dist/index.d.ts` export surface in `node_modules`.\n\n## Quick start\n\n```typescript\nimport { Chat } from \"chat\";\nimport { createSlackAdapter } from \"@chat-adapter/slack\";\nimport { createRedisState } from \"@chat-adapter/state-redis\";\n\nconst bot = new Chat({\n  userName: \"mybot\",\n  adapters: {\n    slack: createSlackAdapter(),\n  },\n  state: createRedisState(),\n  dedupeTtlMs: 600_000,\n});\n\nbot.onNewMention(async (thread) => {\n  await thread.subscribe();\n  await thread.post(\"Hello! I'm listening to this thread.\");\n});\n\nbot.onSubscribedMessage(async (thread, message) => {\n  await thread.post(`You said: ${message.text}`);\n});\n```\n\n## Core concepts\n\n- **Chat** — main entry point; coordinates adapters, routing, locks, and state\n- **Adapters** — platform-specific integrations for Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp\n- **State adapters** — persistence for subscriptions, locks, dedupe, and thread state\n- **Thread** — conversation context with `post()`, `stream()`, `subscribe()`, `setState()`, `startTyping()`\n- **Message** — normalized content with `text`, `formatted`, attachments, author info, and platform `raw`\n- **Channel** — container for threads and top-level posts\n\n## Event handlers\n\n| Handler | Trigger |\n|---------|---------|\n| `onNewMention` | Bot @-mentioned in an unsubscribed thread |\n| `onDirectMessage` | New DM in an unsubscribed DM thread |\n| `onSubscribedMessage` | Any message in a subscribed thread |\n| `onNewMessage(regex)` | Regex match in an unsubscribed thread |\n| `onReaction(emojis?)` | Emoji added or removed |\n| `onAction(actionIds?)` | Button clicks and select/radio interactions |\n| `onModalSubmit(callbackId?)` | Modal form submitted |\n| `onModalClose(callbackId?)` | Modal dismissed/cancelled |\n| `onSlashCommand(commands?)` | Slash command invocation |\n| `onAssistantThreadStarted` | Slack assistant thread opened |\n| `onAssistantContextChanged` | Slack assistant context changed |\n| `onAppHomeOpened` | Slack App Home opened |\n| `onMemberJoinedChannel` | Slack member joined channel event |\n\nRead `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`.\n\n## Streaming\n\nPass 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.\n\n```typescript\nimport { ToolLoopAgent } from \"ai\";\n\nconst agent = new ToolLoopAgent({ model: \"anthropic/claude-4.5-sonnet\" });\n\nbot.onNewMention(async (thread, message) => {\n  const result = await agent.stream({ prompt: message.text });\n  await thread.post(result.fullStream);\n});\n```\n\nKey details:\n- `streamingUpdateIntervalMs` controls post+edit fallback cadence\n- `fallbackStreamingPlaceholderText` defaults to `\"...\"`; set `null` to disable\n- Structured `StreamChunk` support is Slack-only; other adapters ignore non-text chunks\n\n## Cards and modals (JSX)\n\nSet `jsxImportSource: \"chat\"` in `tsconfig.json`.\n\nCard components:\n- `Card`, `CardText`, `Section`, `Fields`, `Field`, `Button`, `CardLink`, `LinkButton`, `Actions`, `Select`, `SelectOption`, `RadioSelect`, `Table`, `Image`, `Divider`\n\nModal components:\n- `Modal`, `TextInput`, `Select`, `SelectOption`, `RadioSelect`\n\n```tsx\nawait thread.post(\n  <Card title=\"Order #1234\">\n    <CardText>Your order has been received.</CardText>\n    <Actions>\n      <Button id=\"approve\" style=\"primary\">Approve</Button>\n      <Button id=\"reject\" style=\"danger\">Reject</Button>\n    </Actions>\n  </Card>\n);\n```\n\n## Adapter inventory\n\n### Official platform adapters\n\n| Platform | Package | Factory |\n|---------|---------|---------|\n| Slack | `@chat-adapter/slack` | `createSlackAdapter` |\n| Microsoft Teams | `@chat-adapter/teams` | `createTeamsAdapter` |\n| Google Chat | `@chat-adapter/gchat` | `createGoogleChatAdapter` |\n| Discord | `@chat-adapter/discord` | `createDiscordAdapter` |\n| GitHub | `@chat-adapter/github` | `createGitHubAdapter` |\n| Linear | `@chat-adapter/linear` | `createLinearAdapter` |\n| Telegram | `@chat-adapter/telegram` | `createTelegramAdapter` |\n| WhatsApp Business Cloud | `@chat-adapter/whatsapp` | `createWhatsAppAdapter` |\n\n### Official state adapters\n\n| State backend | Package | Factory |\n|--------------|---------|---------|\n| Redis | `@chat-adapter/state-redis` | `createRedisState` |\n| ioredis | `@chat-adapter/state-ioredis` | `createIoRedisState` |\n| PostgreSQL | `@chat-adapter/state-pg` | `createPostgresState` |\n| Memory | `@chat-adapter/state-memory` | `createMemoryState` |\n\n### Community adapters\n\n- `chat-state-cloudflare-do`\n- `@beeper/chat-adapter-matrix`\n- `chat-adapter-imessage`\n- `@bitbasti/chat-adapter-webex`\n- `@resend/chat-sdk-adapter`\n- `chat-adapter-baileys`\n\n### Coming-soon platform entries\n\n- Instagram\n- Signal\n- X\n- Messenger\n\n## Building a custom adapter\n\nRead these published docs first:\n- `node_modules/chat/docs/contributing/building.mdx`\n- `node_modules/chat/docs/contributing/testing.mdx`\n- `node_modules/chat/docs/contributing/publishing.mdx`\n\nAlso inspect:\n- `node_modules/chat/dist/index.d.ts` — `Adapter` and related interfaces\n- `node_modules/@chat-adapter/shared/dist/index.d.ts` — shared errors and utilities\n- Installed official adapter `dist/index.d.ts` files — reference implementations for config and APIs\n\nA 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`.\n\n## Webhook setup\n\nEach 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.\n","after":"---\nname: chat-sdk\ndescription: 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.\nmetadata:\n  priority: 8\n  docs:\n    - \"https://chat-sdk.dev/docs\"\n    - \"https://vercel.com/kb/chat-sdk\"\n  sitemap: \"https://chat-sdk.dev/sitemap.xml\"\n  pathPatterns:\n    - \"app/api/chat/**\"\n    - \"app/api/chat-bot/**\"\n    - \"app/api/bot/**\"\n    - \"app/api/slack/**\"\n    - \"app/api/teams/**\"\n    - \"app/api/discord/**\"\n    - \"app/api/gchat/**\"\n    - \"app/api/telegram/**\"\n    - \"app/api/github-bot/**\"\n    - \"app/api/linear-bot/**\"\n    - \"app/api/webhooks/slack/**\"\n    - \"app/api/webhooks/teams/**\"\n    - \"app/api/webhooks/discord/**\"\n    - \"app/api/webhooks/gchat/**\"\n    - \"app/api/webhooks/telegram/**\"\n    - \"app/api/webhooks/github/**\"\n    - \"app/api/webhooks/linear/**\"\n    - \"src/app/api/chat/**\"\n    - \"src/app/api/chat-bot/**\"\n    - \"src/app/api/bot/**\"\n    - \"src/app/api/slack/**\"\n    - \"src/app/api/teams/**\"\n    - \"src/app/api/discord/**\"\n    - \"src/app/api/gchat/**\"\n    - \"src/app/api/telegram/**\"\n    - \"lib/bot.*\"\n    - \"lib/bot/**\"\n    - \"src/lib/bot.*\"\n    - \"src/lib/bot/**\"\n    - \"lib/chat-bot/**\"\n    - \"src/lib/chat-bot/**\"\n    - \"bot/**\"\n    - \"pages/api/bot.*\"\n    - \"pages/api/bot/**\"\n    - \"src/pages/api/bot.*\"\n    - \"src/pages/api/bot/**\"\n    - \"tests/**/bot*\"\n    - \"test/**/bot*\"\n    - \"fixtures/replay/**\"\n    - \"apps/*/app/api/bot/**\"\n    - \"apps/*/app/api/slack/**\"\n    - \"apps/*/app/api/teams/**\"\n    - \"apps/*/app/api/discord/**\"\n    - \"apps/*/lib/bot/**\"\n    - \"apps/*/src/lib/bot/**\"\n  importPatterns:\n    - \"chat\"\n    - \"@chat-adapter/*\"\n  bashPatterns:\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*\\bchat\\b'\n    - '\\byarn\\s+add\\s+[^\\n]*\\bchat\\b'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/'\n    - '\\byarn\\s+add\\s+[^\\n]*@chat-adapter/'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@chat-adapter/telegram'\n    - '\\byarn\\s+add\\s+[^\\n]*@chat-adapter/telegram'\n  promptSignals:\n    phrases:\n      - \"chat sdk\"\n      - \"chat bot\"\n      - \"chatbot\"\n      - \"conversational interface\"\n      - \"slack bot\"\n      - \"telegram bot\"\n      - \"discord bot\"\n      - \"teams bot\"\n    allOf:\n      - [bot, platform]\n      - [bot, multi]\n    anyOf:\n      - \"onNewMention\"\n      - \"onSubscribedMessage\"\n      - \"chat adapter\"\n      - \"cross-platform bot\"\n    noneOf:\n      - \"useChat\"\n    minScore: 6\nretrieval:\n  aliases:\n    - chat ui\n    - chatbot\n    - conversation interface\n    - messaging component\n  intents:\n    - build chatbot\n    - add chat interface\n    - create messaging ui\n    - implement chat feature\n  entities:\n    - useChat\n    - Message\n    - ChatUI\n    - StreamingMessage\n    - chat-sdk\n  examples:\n    - build a chatbot interface\n    - add chat to my app\n    - create a messaging component\nchainTo:\n  -\n    pattern: 'from\\s+[''\"\"]openai[''\"\"]'\n    targetSkill: ai-sdk\n    message: 'Direct OpenAI SDK import in chat bot — loading AI SDK guidance for unified provider abstraction and streaming.'\n  -\n    pattern: 'from\\s+[''\\\"](slack-bolt|@slack/bolt|@slack/web-api)[''\"]|require\\s*\\(\\s*[''\\\"](slack-bolt|@slack/bolt|@slack/web-api)[''\"]|new\\s+App\\s*\\(\\s*\\{\\s*token'\n    targetSkill: chat-sdk\n    message: '@slack/bolt or @slack/web-api detected — use the Chat SDK with @chat-adapter/slack instead for a unified multi-platform bot that works across Slack, Teams, Discord, Telegram, and more.'\n  -\n    pattern: 'from\\s+[''\\\"](discord\\.js|discord-api-types|telegram-bot-api|telegraf|grammy)[''\"]|require\\s*\\(\\s*[''\\\"](discord\\.js|telegraf|grammy)[''\"]'\n    targetSkill: chat-sdk\n    message: 'Platform-specific bot library detected — use the Chat SDK with the corresponding @chat-adapter/* package for a unified multi-platform bot codebase.'\n  -\n    pattern: 'setTimeout\\s*\\(|setInterval\\s*\\(|while\\s*\\(\\s*true'\n    targetSkill: workflow\n    message: 'Long-running or polling logic in chat bot — loading Workflow SDK for durable execution that survives deploys.'\n    skipIfFileContains: 'use workflow|from\\s+[''\"]workflow[''\"]'\n  -\n    pattern: 'process\\.env\\.(OPENAI_API_KEY|ANTHROPIC_API_KEY)|from\\s+[''\"]@ai-sdk/(anthropic|openai)[''\"\"]'\n    targetSkill: ai-gateway\n    message: 'Direct provider API key in chat bot — loading AI Gateway guidance for OIDC auth and model routing.'\n    skipIfFileContains: 'gateway\\(|@ai-sdk/gateway'\n---\n\n# Chat SDK\n\nUnified TypeScript SDK for building chat bots across Slack, Microsoft Teams, Google Chat, Discord, Telegram, GitHub, Linear, WhatsApp, and more. Write your bot logic once, deploy everywhere.\n\n## Scaffold a new project\n\nUse `create-chat-sdk` to scaffold a basic Next.js bot project without prompts. Run `npx create-chat-sdk --help` to see the available options and how the CLI works.\n\n## Start with Chat SDK documentation\n\nWhen Chat SDK is installed in a user's project, inspect the published docs that ship in `node_modules/chat/docs/`, the resources in `node_modules/chat/resources/`, and the available open source templates in `node_modules/chat/resources/templates.json`.\n\nIf those paths do not exist, the `chat` package is not installed in the project yet. The user can install it with `npm i chat`.\n\nYou can also find the docs on the [Chat SDK website](https://chat-sdk.dev/docs) and in the [Vercel knowledge base](https://vercel.com/kb/chat-sdk).\n\n## Available resources\n\n<!-- RESOURCES:START -->\n\n### Guides\n\n- `node_modules/chat/resources/guides/how-to-build-an-ai-agent-for-slack-with-chat-sdk-and-ai-sdk.md` — Build a Slack AI agent using Chat SDK, AI SDK's ToolLoopAgent, and Vercel AI Gateway. Covers project setup, tool definitions, streaming responses, deployment to Vercel, and scaling tool selection with toolpick.\n- `node_modules/chat/resources/guides/human-in-the-loop-with-chat-sdk-and-workflow-sdk.md` — Pause durable workflows on Slack approval cards using Chat SDK and Workflow SDK. Uses createWebhook to suspend workflows until a button click, with patterns for multi-stage approvals, timeouts via durable sleep, and approver validation.\n- `node_modules/chat/resources/guides/liveblocks-chat-sdk-ai-sdk.md` — Build an AI agent that replies to @-mentions in Liveblocks comment threads with streamed responses and tool calling. Uses Chat SDK, the Liveblocks adapter, AI SDK's ToolLoopAgent, and Redis for thread subscriptions and distributed locking.\n- `node_modules/chat/resources/guides/slack-bot-vercel-blob.md` — Build a Slack bot that lists, reads, uploads, and deletes files in Vercel Blob through tool calls. Uses Chat SDK, AI SDK's ToolLoopAgent, and Files SDK's createFileTools factory with approval-gated write tools and a read-only mode.\n- `node_modules/chat/resources/guides/run-and-track-deploys-from-slack.md` — Build a Slack deploy bot with Chat SDK and Vercel Workflow. Dispatch GitHub Actions from a slash command, gate production behind approval, poll for completion, and notify Linear and GitHub when the run finishes.\n- `node_modules/chat/resources/guides/triage-form-submissions-with-chat-sdk.md` — Build a Slack bot that triages form submissions with interactive cards. Forward, edit, or mark as spam without leaving Slack. Built with Chat SDK, Hono, and Resend.\n- `node_modules/chat/resources/guides/how-to-build-a-slack-bot-with-next-js-and-redis.md` — This guide walks through building a Slack bot with Next.js, covering project setup, Slack app configuration, event handling, interactive features, and deployment.\n- `node_modules/chat/resources/guides/create-a-discord-support-bot-with-nuxt-and-redis.md` — This guide walks through building a Discord support bot with Nuxt, covering project setup, Discord app configuration, Gateway forwarding, AI-powered responses, and deployment.\n- `node_modules/chat/resources/guides/ship-a-github-code-review-bot-with-hono-and-redis.md` — This guide walks through building a GitHub bot that reviews pull requests on demand. When a user @mentions the bot on a PR, Chat SDK picks up the mention, spins up a Vercel Sandbox with the repo cloned, and uses AI SDK to analyze the diff.\n- `node_modules/chat/resources/guides/build-a-slack-bot-with-vercel-connect.md` — Learn how to build your very own Slackbot with Chat SDK and AI SDK. Vercel Connect supplies runtime Slack tokens and forwards triggers, so you never store a long-lived bot token.\n- `node_modules/chat/resources/guides/vercel-connect.md` — Use Vercel Connect to call provider APIs like Slack, GitHub, and Snowflake from your agents and services with short-lived, user-authorized tokens instead of long-lived secrets.\n- `node_modules/chat/resources/guides/ai-gateway-and-ai-sdk.md` — Build AI agents on Vercel with AI Gateway and AI SDK, then make them reliable, capable, and durable with Sandbox, Chat SDK, Vercel Connect, and Workflow.\n- `node_modules/chat/resources/guides/daily-digest-bot-with-chat-sdk-and-workflow-sdk.md` — Create your own daily digest bot that posts a daily digest of GitHub stats to Slack. Learn how to use Vercel Connect to set up Slack and GitHub app securely in your project.\n\n### Templates\n\nListed in `node_modules/chat/resources/templates.json`:\n\n- **Chat SDK Liveblocks Bot** — Build a bot that you can engage with inside Liveblocks. (https://vercel.com/templates/next.js/chat-sdk-liveblocks-bot)\n- **Durable iMessage Agent** — Durable iMessage agent powered by the Sendblue adapter. (https://vercel.com/templates/nitro/durable-imessage-ai-agent)\n- **Knowledge Agent** — Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base. (https://vercel.com/templates/nuxt/chat-sdk-knowledge-agent)\n- **Community Agent** — Open source AI-powered Slack community management bot with a built-in Next.js admin panel. Uses Chat SDK, AI SDK, and Vercel Workflow. (https://vercel.com/templates/next.js/chat-sdk-community-agent)\n- **Caltext** — iMessage calorie tracking assistant powered by AI. (https://vercel.com/templates/hono/caltext)\n\n<!-- RESOURCES:END -->\n\n## Chat SDK adapters\n\n### Adapter directory\n\nSee the 'Official Adapters', 'Vendor-Official Adapters', and 'Community Adapters' sections in the [Chat SDK llms.txt file](https://chat-sdk.dev/llms.txt) for the current list of official, vendor-official, and community adapters.\n\n### Adapter catalog subpath\n\nChat SDK exposes a zero-dependency static catalog at `chat/adapters`.\n\nAgents can import `ADAPTERS`, `ADAPTER_NAMES`, `getAdapter`, `isAdapterSlug`, `listEnvVars`, `getSecretEnvVars`, and metadata types like `CatalogAdapter` and `AdapterSlug` from this subpath without importing any adapter implementation package.\n\nUse it for:\n- Listing official and vendor-official adapter slugs, names, npm packages, groups, and platform vs state types.\n- Building setup or onboarding flows that need package names, peer dependencies, and install guidance before any adapter is installed.\n- Discovering required, optional, and credential-mode environment variables for an adapter, including which variables are secrets.\n- Keeping vendor-official adapter docs and metadata aligned with the catalog when adding or updating a listed adapter."}],"summary":"Fields changed: 1. /skill_md_contents.","summary_kind":"deterministic","summary_metadata":{}}