Development · Tip
Vercel Chat SDK Patterns and Code Snippets
Code patterns for building cross-platform chat bots with Vercel Chat SDK
A collection of practical code patterns illustrating how to build bots using Vercel's multi-platform Chat SDK in TypeScript. It demonstrates multi-adapter configuration, Redis state management, event subscription, and streaming LLM responses directly into chat threads.
How it works
Init: new Chat({userName:'mybot', adapters:{slack:createSlackAdapter()}, state:createRedisState()}); handlers onNewMention(async (thread) => {await thread.subscribe(); await thread.post("Hello!")}); onSubscribedMessage; onReaction([emoji.thumbs_up, emoji.heart]); posting via string/Markdown/AST/JSX; streaming ToolLoopAgent from 'ai' with anthropic/claude-4.5-sonnet, agent.stream + thread.post(result.textStream).
What it's for
- Configure a single bot backend across Slack, Discord, Teams, or Google Chat
- Persist conversation state across chat events using Redis adapters
- Stream agentic LLM outputs directly into chat messages using Vercel AI SDK
Key points
- Multi-adapter bot initialization supporting Slack and other chat platforms
- State persistence integration using Redis
- Event handlers for mentions, subscribed messages, and reaction triggers
- Rich message rendering options including raw text, Markdown, AST, and JSX
- Integration patterns with Vercel AI SDK streaming agents and Claude models
Pricing
Open source
Details
- Type
- Tip
- Category
- Development
- Topic
- AI Chatbots
- Open source
- Yes
- Platforms
- Code library
- For
- TypeScript developers building AI chat bots
- Alternative to
- Botpress, Bolt for JavaScript
- Tags
- bots, vercel, typescript, slack, ai sdk, streaming
Why it was saved
- @haydenbleasel: Reference snippets for a Chat bot with Slack, state, reactions, streaming
Compare
Related
No-code platform building custom AI chatbots from website sitemaps and business documents
Open-weights AI models and chat interface for reasoning, coding, and research.
Conversational AI assistant with open-weights reasoning and general language models
Conversational AI assistant built on Google's large language models
Unified TypeScript SDK overview for multi-platform chat bot development
Universal TypeScript layer for building bots and agents across chat platforms
Updated