# 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 is 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](https://xiry.app/topics/development.md)
- Topic: [AI Chatbots](https://xiry.app/topics/ai/ai-chatbots.md)
- 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, 24 February 2026](https://x.com/haydenbleasel/status/2026359649499492395): Reference snippets for a Chat bot with Slack, state, reactions, streaming

## Compare

- [Alternatives to Botpress](https://xiry.app/alternatives/botpress.md)

## Related

- [CustomGPT.ai](https://xiry.app/resources/customgpt-ai): No-code platform building custom AI chatbots from website sitemaps and business documents (Web app, Paid)
- [DeepSeek](https://xiry.app/resources/deepseek): Open-weights AI models and chat interface for reasoning, coding, and research. (AI model, Freemium)
- [DeepSeek Chat](https://xiry.app/resources/deepseek-chat): Conversational AI assistant with open-weights reasoning and general language models (Web app, Freemium)
- [Google Gemini](https://xiry.app/resources/google-gemini): Conversational AI assistant built on Google's large language models (Web app, Freemium)
- [Chat SDK 101](https://xiry.app/resources/chat-sdk-101): Unified TypeScript SDK overview for multi-platform chat bot development (Tip, Open source)
- [Chat SDK](https://xiry.app/resources/chat-sdk): Universal TypeScript layer for building bots and agents across chat platforms (GitHub repo, Open source)

Updated 11 October 2026. Page: https://xiry.app/resources/vercel-chat-sdk-patterns-and-code-snippets

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
