CLI
create-chat-sdk creates a minimal Next.js app for a Chat SDK bot. Based on the adapters you pick from the adapter catalog, it generates your Chat configuration, a webhook route, a .env.example file, and the dependency list, plus a Web adapter route if you select that adapter.
Quick start
create-chat-sdk detects when Cursor, Claude Code, or another coding agent runs it. In that case the CLI runs non-interactively: pass at least one platform adapter with --adapter, and it uses memory as the state adapter and my-bot as the project name unless you provide others. Pass --interactive to force prompts.
Non-interactive usage
Pass platform and state adapters with --adapter:
With npm, the -- separator is required because npm consumes flags before it (-y is npm's own --yes) instead of forwarding them to the CLI. pnpm create and yarn create forward flags without it.
The interactive prompt lists official adapters by default. Pass --vendor to list only vendor-official adapters instead. Scripts and coding agents can skip the prompt and pass any official or vendor-official adapter the CLI supports to --adapter.
Adapters that require a long-running process, including Matrix and Lark, cannot run on the webhook-only serverless runtime and are not available through the CLI. Add them to an existing project manually instead.
View available adapter slugs
Official platform adapters
Vendor-official platform adapters
State adapters
- cloudflare-agents - Cloudflare Agents
- ioredis - ioredis
- memory - Memory
- postgres - PostgreSQL
- redis - Redis
Examples:
What gets generated
The scaffolded app is webhook-only. It does not include pages, layouts, or a client UI.
Webhook endpoints use the selected adapter slug:
When the Web adapter is selected, the CLI also creates /api/chat for browser chat requests and a small getUser auth stub. Replace the stub with your app's real authentication logic so each web conversation can be associated with the correct user.
When the Discord adapter is selected, the CLI also creates a Gateway listener at /api/discord/gateway and a vercel.json cron that calls it. Discord delivers slash commands and button clicks to the webhook route, but regular messages and reactions only arrive over the Gateway WebSocket, so the cron keeps that connection alive and forwards events to /api/webhooks/discord. Set a CRON_SECRET environment variable to authenticate the cron requests. The generated serverless Gateway cron requires Vercel Pro or Enterprise because it runs every nine minutes.
Vercel Connect
Vercel Connect supplies outbound credentials for the Slack, Discord, GitHub, Linear, Notion, Teams, and Telegram adapters. To scaffold Connect wiring for any selected adapter in that list, pass --connect or choose Vercel Connect at the interactive auth-mode prompt. Notion and Telegram webhooks stay direct and keep their native verification secrets.
The generated src/lib/bot.ts spreads the matching helper from @vercel/connect/chat into the adapter factory, @vercel/connect is added to dependencies, and .env.example lists each connector UID, for example SLACK_CONNECTOR.
For Linear, --adapter linear --connect explicitly sets mode: "agent-sessions", the recommended setup for Connect bots. Enable Agent session events on the Linear app and use an app-actor installation. The adapter itself still defaults to "comments" when mode is omitted.
For Microsoft Teams, use --adapter teams --connect. The generated bot uses
connectTeamsAdapter(requireEnv("TEAMS_CONNECTOR")), and .env.example expects
a connector UID such as microsoft-teams/my-bot instead of Azure credentials.
Forward Connect triggers to /api/webhooks/teams. Microsoft Graph reads require
the bot's resource-specific permissions to be granted when it is installed in a
team. This setup requires releases of both @vercel/connect and
@chat-adapter/teams that support the Teams Connect helper.
Vercel Connect provides VERCEL_OIDC_TOKEN at runtime. For local development, run vercel link then vercel env pull to populate it. Connect forwards inbound webhooks only to deployed URLs, so test webhook delivery against a Vercel deployment (such as a preview) rather than localhost.
Reference
| Option | Description |
|---|---|
[name] | Name of the project. |
-d, --description <text> | Project description. |
--adapter <values...> | Platform or state adapters to include. |
--vendor | List only vendor-official adapters in the interactive prompt. |
--connect | Authenticate Slack, Discord, GitHub, Linear, Notion, Teams, and Telegram adapters with Vercel Connect. |
--pm <manager> | Package manager to use: npm, yarn, pnpm, or bun. |
-y, --yes | Skip prompts and accept defaults. |
--interactive | Always prompt, even when a coding agent environment is detected. |
-f, --force | Overwrite generated files in an existing directory. |
-s, --skip-install | Skip dependency installation. |
--no-git | Skip git repository initialization. |
-q, --quiet | Suppress non-essential output. |
Color output follows the NO_COLOR standard. Set NO_COLOR=1 to disable colors.
Customize your bot
Most bot behavior lives in src/lib/bot.ts. Start there when you want to:
- Add or change handlers like
onNewMention,onSubscribedMessage,onNewMessage, reactions, actions, or slash commands. - Adjust adapter configuration, for example passing explicit credentials or platform-specific options instead of relying only on environment variables.
- Replace the memory state adapter, if you selected it, with Redis, ioredis, or PostgreSQL before deploying to production.
The generated file includes starter handlers for mentions and subscribed thread replies.
Next steps
After scaffolding:
Fill in the generated environment variables, expose your local server, and configure each selected platform to call its /api/webhooks/{adapter} endpoint.
Resources
See guides, templates, and examples on the resources page.
Read more
Introduction
A unified SDK for building chat bots across Slack, Microsoft Teams, Google Chat, Discord, Telegram, and more.
Getting Started
Pick a guide to start building with Chat SDK.
Creating a Chat Instance
Initialize the Chat class with adapters, state, and configuration options.
Threads, Messages, and Channels
Work with threads, messages, and channels across platforms.