This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @chat-adapter/github@4.33.0 ### Minor Changes -6750d59: Add Vercel Connect support to the GitHub adapter. A new `installationToken` config option (string or resolver) supplies installation access tokens directly, skipping the GitHub App private-key JWT exchange, and an optional `webhookVerifier` verifies inbound webhooks (e.g. Connect trigger-forwarded requests via a Vercel OIDC token) in place of the GitHub webhook secret. Pair with `connectGitHubAdapter()` from `@vercel/connect/chat`. `botUserId` now also auto-detects from the `GITHUB_BOT_USER_ID` env var, and the adapter learns its bot user id from the first comment it posts. In Connect mode (where the bot user id can't be auto-detected from an installation token) set `botUserId` / `GITHUB_BOT_USER_ID` to enable self-message detection and avoid the adapter replying to its own comments. Note: the `connectGitHubAdapter()` helper ships in `@vercel/connect` — release this adapter together with (or after) the `@vercel/connect` version that adds the `@vercel/connect/chat` subpath so the documented helper resolves. ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/linear@4.33.0 ### Minor Changes -4115c94: Add Vercel Connect support to the Linear adapter. The `accessToken` config option now accepts a resolver (`() => string | Promise<string>`) in addition to a string, so tokens can be sourced from Vercel Connect at runtime, and a new optional `webhookVerifier` verifies inbound webhooks (e.g. Connect trigger-forwarded requests via a Vercel OIDC token) in place of the Linear webhook secret. Pair with `connectLinearAdapter()` from `@vercel/connect/chat`. Connect-mode outbound calls outside webhook handling are supported via `withInstallation(organizationId, fn)`. Note: the `connectLinearAdapter()` helper ships in `@vercel/connect` — release this adapter together with (or after) the `@vercel/connect` version that adds the `@vercel/connect/chat` subpath so the documented helper resolves. ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/shared@4.33.0 ### Minor Changes -d4c52ca: add `replaceBareMentions`, a context-aware bare-`@mention` resolver that skips code spans, URLs, schemeless hosts, and existing angle-bracket tokens before handing each real `@name` to a platform-specific replacer ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [076fe5d] - chat@4.33.0 ## @chat-adapter/x@4.33.0 ### Minor Changes -ef2542c: add X (Twitter) adapter: reply to public mentions, send and receive direct messages, post and edit from the bot account, and like posts, using the X API v2 with OAuth 2.0 and managed token refresh ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## chat@4.33.0 ### Minor Changes -ef2542c: add X (Twitter) adapter: reply to public mentions, send and receive direct messages, post and edit from the bot account, and like posts, using the X API v2 with OAuth 2.0 and managed token refresh ### Patch Changes -3abdc69: docs(adapters): add Cloudflare Agents as a vendor-official state adapter (`agents/chat-sdk`) to the catalog and docs listing. It is hidden from the create-chat-sdk CLI (Worker/Durable Objects runtime), and the interactive state picker now filters out CLI-incompatible state adapters. -0b63791: Raise the default message dedupe TTL from 5 to 10 minutes so it outlives the longest platform redelivery window. Slack's Events API retries up to ~5 minutes after the original delivery — exactly at the old TTL boundary, where a retried event could miss the expired dedupe entry from its first processing and be handled twice. Configurable behavior is unchanged (`dedupeTtlMs` still overrides). -0c761f1: docs(adapters): add Dial as a vendor-official adapter (`@getdial/chat-sdk-adapter`) to the catalog, docs listing, and CLI scaffold spec -24a04d5: docs(adapters): add Photon as a vendor-official adapter (`@photon-ai/chat-adapter-imessage`) to the catalog, docs listing, and CLI scaffold spec -076fe5d: preserve skipped mention routing for debounce and message patterns ## create-chat-sdk@0.2.0 ### Minor Changes -ba375ce: Add Vercel Connect support to the scaffolder. Pass `--connect` (or choose **Vercel Connect** at the new interactive auth-mode prompt) to authenticate the Slack, GitHub, and Linear adapters with a Vercel Connect connector instead of stored provider 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`) plus the recommended `GITHUB_BOT_USER_ID` for GitHub, in place of native secrets. -ef2542c: add X (Twitter) adapter: reply to public mentions, send and receive direct messages, post and edit from the bot account, and like posts, using the X API v2 with OAuth 2.0 and managed token refresh ### Patch Changes -3abdc69: docs(adapters): add Cloudflare Agents as a vendor-official state adapter (`agents/chat-sdk`) to the catalog and docs listing. It is hidden from the create-chat-sdk CLI (Worker/Durable Objects runtime), and the interactive state picker now filters out CLI-incompatible state adapters. -0c761f1: docs(adapters): add Dial as a vendor-official adapter (`@getdial/chat-sdk-adapter`) to the catalog, docs listing, and CLI scaffold spec -24a04d5: docs(adapters): add Photon as a vendor-official adapter (`@photon-ai/chat-adapter-imessage`) to the catalog, docs listing, and CLI scaffold spec ## @chat-adapter/tests@4.33.0 ### Minor Changes -e7a396a: Add two shared behavioral test contracts for adapter authors: - `threadIdContract` — verifies an adapter's thread-id codec round-trips (`decode(encode(x))`), prefixes ids with the adapter name, matches any pinned encoded strings, and (optionally) distinguishes DM from non-DM threads. - `selfMessageContract` — verifies an adapter dispatches inbound messages from other users (to `processMessage` by default) but ignores messages the bot authored itself, so it never replies to itself. Requires the matchers to be registered via `setupFiles: ["@chat-adapter/tests/setup"]`. -a7fb1bc: Add `connectWebhookContract`, a shared Vitest suite for verifying an adapter's Vercel Connect webhook verification. Given a small per-adapter descriptor (how to build the adapter in Connect mode and craft an inbound webhook), it asserts the behavior every Connect-capable adapter shares: a `webhookVerifier` replaces the native signature/secret check and gates inbound requests — accept (`200`) on a truthy result, reject (`401`) on a thrown error or falsy result — and is invoked with the request and raw body. Connect-capable adapters can opt in with ~10 lines. ## @chat-adapter/discord@4.33.0 ### Patch Changes -d4c52ca: use the shared `replaceBareMentions` scanner for `@mention` conversion so email addresses, `@handles` inside URLs, and mentions inside code spans are no longer mangled into Discord mentions, and already-formatted `<@id>` tokens are not double-wrapped -6de4572: Implement `rehydrateAttachment` on the Discord adapter. Serialization strips an attachment's `fetchData` closure (queue/debounce strategies), and consumers rebuild it via `adapter.rehydrateAttachment`. The Discord adapter did not implement the method, so downstream consumers could not download inbound Discord attachments after deserialization. The Discord CDN `url` survives serialization, so `fetchData` is now rebuilt to fetch that url (preserving its signed query params), matching how the other adapters implement the method. - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/gchat@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/messenger@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/slack@4.33.0 ### Patch Changes -0b63791: Process Slack Socket Mode retry envelopes instead of discarding them. Slack redelivers an event (immediately, +1 min, +5 min) when a prior delivery wasn't acknowledged — including events sent while the app had no open socket, e.g. during a restart or a routine connection refresh. The adapter previously acked and dropped every envelope with `retry_num > 0`, so such events were permanently lost even though Slack redelivered them. Retries are now routed like first deliveries (logged at info with `retry_num`/`retry_reason`); `Chat.processMessage`'s message-id dedupe drops true duplicates. - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/teams@4.33.0 ### Patch Changes -d4c52ca: use the shared `replaceBareMentions` scanner for `@mention` conversion so email addresses, `@handles` inside URLs, and mentions inside code spans are no longer mangled into `<at>` mention tags - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/telegram@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/twilio@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/web@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/whatsapp@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [d4c52ca] - Updated dependencies [076fe5d] - chat@4.33.0 - @chat-adapter/shared@4.33.0 ## @chat-adapter/state-ioredis@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [076fe5d] - chat@4.33.0 ## @chat-adapter/state-memory@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [076fe5d] - chat@4.33.0 ## @chat-adapter/state-pg@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [076fe5d] - chat@4.33.0 ## @chat-adapter/state-redis@4.33.0 ### Patch Changes - Updated dependencies [3abdc69] - Updated dependencies [0b63791] - Updated dependencies [0c761f1] - Updated dependencies [ef2542c] - Updated dependencies [24a04d5] - Updated dependencies [076fe5d] - chat@4.33.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/telegram
npm package:
@chat-adapter/telegram
Telegram adapter for Chat SDK. Configure for bot webhooks and messaging.
Documentation: chat-sdk.dev/adapters/official/telegram · Guides: vercel.com/kb/chat-sdk
Installation
pnpm add @chat-adapter/telegram
Scaffold with the CLI
To scaffold a new Telegram bot with this adapter preselected:
npx create-chat-sdk@latest my-bot --adapter telegram memory
Visit the adapters directory to see other available official and vendor-official adapters.
Usage
The adapter auto-detects TELEGRAM_BOT_TOKEN, TELEGRAM_WEBHOOK_SECRET_TOKEN, TELEGRAM_BOT_USERNAME, and TELEGRAM_API_BASE_URL from environment variables:
import { Chat } from "chat";
import { createTelegramAdapter } from "@chat-adapter/telegram";
const bot = new Chat({
userName: "mybot",
adapters: {
telegram: createTelegramAdapter(),
},
});
bot.onNewMention(async (thread, message) => {
await thread.post(`You said: ${message.text}`);
});
Webhook route
import { bot } from "@/lib/bot";
export async function POST(request: Request): Promise<Response> {
return bot.webhooks.telegram(request);
}
Configure this URL as your bot webhook in BotFather / Telegram API:
curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/setWebhook" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-domain.com/api/webhooks/telegram",
"secret_token": "your-secret-token"
}'
Polling (local development)
When developing locally you typically can't expose a public URL for Telegram to deliver webhooks to. Polling mode uses getUpdates to fetch messages directly from Telegram instead — no public endpoint needed.
The longPolling option is entirely optional. Sensible defaults are applied when omitted.
import { Chat } from "chat";
import { createTelegramAdapter } from "@chat-adapter/telegram";
import { createMemoryState } from "@chat-adapter/state-memory";
const telegram = createTelegramAdapter({
mode: "polling",
// Optional — fine-tune polling behavior:
// longPolling: { timeout: 30, dropPendingUpdates: false },
});
const bot = new Chat({
userName: "mybot",
adapters: { telegram },
state: createMemoryState(),
});
// Optional manual lifecycle control:
// await telegram.resetWebhook();
// await telegram.startPolling();
// await telegram.stopPolling();
Auto mode
With mode: "auto" (the default), the adapter picks the right strategy for you. When deployed to a serverless environment like Vercel it uses webhooks; everywhere else (e.g. local dev) it falls back to polling automatically.
import { Chat } from "chat";
import { createTelegramAdapter } from "@chat-adapter/telegram";
import { createMemoryState } from "@chat-adapter/state-memory";
const telegram = createTelegramAdapter({
mode: "auto", // default
});
export const bot = new Chat({
userName: "mybot",
adapters: { telegram },
state: createMemoryState(),
});
// Call initialize() so polling can start in long-running local processes:
void bot.initialize();
console.log(telegram.runtimeMode); // "webhook" | "polling"
Configuration
All options are auto-detected from environment variables when not provided.
| Option | Required | Description |
|---|---|---|
botToken |
No* | Telegram bot token. Auto-detected from TELEGRAM_BOT_TOKEN |
secretToken |
No | Optional webhook secret token. Auto-detected from TELEGRAM_WEBHOOK_SECRET_TOKEN |
mode |
No | Adapter mode: auto (default), webhook, or polling |
longPolling |
No | Optional long polling config for getUpdates (timeout, limit, allowedUpdates, deleteWebhook, dropPendingUpdates, retryDelayMs) |
userName |
No | Bot username used for mention detection. Auto-detected from TELEGRAM_BOT_USERNAME or getMe |
apiUrl |
No | Telegram API base URL. Auto-detected from TELEGRAM_API_BASE_URL. Use apiUrl for cross-adapter consistency; the legacy apiBaseUrl alias is still accepted |
logger |
No | Logger instance (defaults to ConsoleLogger("info")) |
*botToken is required — either via config or env vars.
Environment variables
TELEGRAM_BOT_TOKEN=123456:ABCDEF...
TELEGRAM_WEBHOOK_SECRET_TOKEN=your-webhook-secret
TELEGRAM_BOT_USERNAME=mybot
# Optional (self-hosted API gateway)
TELEGRAM_API_BASE_URL=https://api.telegram.org
Features
Messaging
| Feature | Supported |
|---|---|
| Post message | Yes |
| Edit message | Yes |
| Delete message | Yes |
| File uploads | Single file (sendDocument) |
| Attachment uploads | Single image/audio/video/file (sendPhoto, sendAudio, sendVideo, sendDocument) |
| Streaming | Private chat rich draft previews + post/edit fallback |
Rich content
| Feature | Supported |
|---|---|
| Card format | MarkdownV2 + inline keyboard buttons |
| Buttons | Inline keyboard callbacks |
| Link buttons | Inline keyboard URLs |
| Select menus | No |
| Tables | Native for markdown and AST messages, ASCII in cards |
| Fields | Yes |
| Images in cards | No |
| Modals | No |
Conversations
| Feature | Supported |
|---|---|
| Slash commands | No |
| Mentions | Yes |
| Add reactions | Yes |
| Remove reactions | Yes |
| Typing indicator | Yes |
| DMs | Yes |
| Ephemeral messages | No |
Message history
| Feature | Supported |
|---|---|
| Fetch messages | Cached |
| Fetch single message | Cached |
| Fetch thread info | Yes |
| Fetch channel messages | Cached |
| List threads | No |
| Fetch channel info | Yes |
| Post channel message | Yes |
Markdown formatting
On Telegram Bot API 10.1 and newer, explicit { markdown } and { ast } messages use rich messages, including native headings, lists, tables, task lists, formulas, details, and separate media blocks supported by the Bot API. Private chat streams use rich draft previews and persist the completed response as a rich message.
Plain strings, raw messages, cards, and media captions retain their existing lightweight message paths. Cards and captions use Telegram's MarkdownV2 parse mode with context-aware escaping. If an older or custom Bot API server does not support rich message methods, the adapter automatically falls back to the existing MarkdownV2 path.
Behavior change in 4.27.0: previous versions used Telegram's legacy Markdown parse mode, which used different syntax (*bold* instead of **bold**) and silently rejected any text containing unescaped ., !, (, ), -, _. If you were emitting raw legacy-Markdown strings or hand-escaping characters yourself, drop the manual escaping. The renderer does it for you. Pass { raw: "..." } only if you need to ship a fully pre-escaped MarkdownV2 string.
Notes
- Telegram does not expose full historical message APIs to bots.
fetchMessages/fetchChannelMessagesreturn adapter-cached messages from the current process. listThreadsis not available for Telegram chats.- Polling and webhooks are mutually exclusive in Telegram.
mode: "polling"deletes webhook by default before callinggetUpdates.mode: "auto"checksgetWebhookInfo: if a webhook URL exists it uses webhook mode; if it is empty it falls back to polling on non-serverless runtimes without deleting webhook.- If
getWebhookInfofails inmode: "auto", the adapter stays in webhook mode (safe fallback). ButtonandLinkButtonin cardActionsrender as inline keyboard buttons.- Telegram callback data is limited to 64 bytes. Keep button
id/valuepayloads short. filesupload as Telegram documents.attachmentspreserve the normalized media type for single image, audio, video, or file uploads. UsedataorfetchDatafor private/authenticated files; URL-only attachments must be public URLs Telegram can fetch directly.- Other rich card elements (images/select menus/radios) render as fallback text only.
AI Coding Agents
If you use an AI coding agent such as OpenAI Codex, Claude Code, or Cursor, install the Chat SDK skill so it knows the SDK APIs, adapter patterns, and project conventions before writing code.
npx skills add vercel/chat
The skill references bundled documentation in node_modules/chat/docs, plus adapter guides and starter templates in the published package.
You can also install the Vercel Plugin for a broader agent toolkit — it includes the Chat SDK skill alongside specialist agents, agent slash commands, and more:
npx plugins add vercel/vercel-plugin
The plugin is optional; the skill alone is enough to build with Chat SDK.
For agent-readable documentation, see chat-sdk.dev/llms.txt (page index) or chat-sdk.dev/llms-full.txt (full text).
License
MIT