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/slack@4.36.0 ### Minor Changes -0153a39: Add `DateInput` and `NumberInput` modal children. The Slack adapter renders them as a `datepicker` and a `number_input`, the Teams adapter as `Input.Date` and `Input.Number`, and both submitted values arrive in `event.values` as strings. Teams submit values that arrive as JSON numbers are now stringified into `event.values` instead of being dropped. This fixes `Input.Number`, but applies to any numeric value a Teams dialog submits — a key that was previously absent from `event.values` will now be present as a string. ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/teams@4.36.0 ### Minor Changes -0153a39: Add `DateInput` and `NumberInput` modal children. The Slack adapter renders them as a `datepicker` and a `number_input`, the Teams adapter as `Input.Date` and `Input.Number`, and both submitted values arrive in `event.values` as strings. Teams submit values that arrive as JSON numbers are now stringified into `event.values` instead of being dropped. This fixes `Input.Number`, but applies to any numeric value a Teams dialog submits — a key that was previously absent from `event.values` will now be present as a string. ### Patch Changes -257a32d: Route Teams personal and group conversations using their explicit conversation type so group chats use buffered fallback even when their IDs resemble direct messages. -3c37cfb: Authenticate connector-hosted inline attachments and parse Teams file download cards. - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/x@4.36.0 ### Minor Changes -caa6325: Add XChat support to `@chat-adapter/x`, shipped from the new `@chat-adapter/x/chat` subpath so it sits alongside the existing X adapter. The XChat crypto stack (`@xdevplatform/chat-xdk`, `@xdevplatform/xdk`, `juicebox-sdk`) is an optional peer dependency, so existing `@chat-adapter/x` users are unaffected. All cryptography is handled inside the adapter via `@xdevplatform/chat-xdk` (wasm) and all REST goes through the typed `@xdevplatform/xdk` client. Only a bot token and a Juicebox PIN are required: the bot's identity (user id and @handle) is resolved from `GET /2/users/me` at startup. - Encrypted send/receive in DMs and groups (webhook push + polling), signature verification on by default; undecryptable or unverified events are dropped - Webhook POSTs must carry a valid `x-twitter-webhooks-signature`, which X sends on every delivery. Set `consumerSecret` (or `X_CONSUMER_SECRET`) to receive webhooks, or `disableWebhookVerification` when an upstream layer already verifies them. Polling deployments are unaffected - Mention detection from structured mention entities, swipe-replies to the bot, and a plain-text `@handle` fallback; group replies sent as quoted replies - `openDM(userId)` starts (or reuses) an encrypted 1:1, running a full key exchange when needed so the bot can message first - Media both ways: inbound attachments with lazy download+decrypt, outbound encrypted uploads - Edit and delete of the bot's own messages; the first edit of a fresh message is age-gated by `editSafetyDelayMs` (default 5000ms) so receiving clients have stored the original - Reactions in and out, read receipts (`sendReadReceipts`, default on), typing keep-alive, configurable group welcome message - Cards degrade to text with tappable URL/mention entities plus a URL preview attachment - Requests carry a `chat-sdk-xchat/<version>` User-Agent product token so Chat SDK traffic is identifiable in X API request logs (a User-Agent set via `apiHeaders` takes precedence) - Registered in the `chat/adapters` catalog and the `create-chat-sdk` CLI scaffold, with a new optional `importPath` catalog field for adapters that ship on a subpath ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## chat@4.36.0 ### Minor Changes -c5d86b1: confine built-in agent read tools to the conversation being handled, with an optional scope override -0153a39: Add `DateInput` and `NumberInput` modal children. The Slack adapter renders them as a `datepicker` and a `number_input`, the Teams adapter as `Input.Date` and `Input.Number`, and both submitted values arrive in `event.values` as strings. Teams submit values that arrive as JSON numbers are now stringified into `event.values` instead of being dropped. This fixes `Input.Number`, but applies to any numeric value a Teams dialog submits — a key that was previously absent from `event.values` will now be present as a string. ### Patch Changes -257a32d: Route Teams personal and group conversations using their explicit conversation type so group chats use buffered fallback even when their IDs resemble direct messages. -b547f45: Stop treating email addresses as bot mentions. A message containing `jane@acme.com` no longer triggers a bot named `acme`, because the `@` in `detectMention` must not follow a word character. Real mentions are unaffected, including at the start of a message, after punctuation, and suffixed names such as GitHub's `mybot[bot]`. -caa6325: Add XChat support to `@chat-adapter/x`, shipped from the new `@chat-adapter/x/chat` subpath so it sits alongside the existing X adapter. The XChat crypto stack (`@xdevplatform/chat-xdk`, `@xdevplatform/xdk`, `juicebox-sdk`) is an optional peer dependency, so existing `@chat-adapter/x` users are unaffected. All cryptography is handled inside the adapter via `@xdevplatform/chat-xdk` (wasm) and all REST goes through the typed `@xdevplatform/xdk` client. Only a bot token and a Juicebox PIN are required: the bot's identity (user id and @handle) is resolved from `GET /2/users/me` at startup. - Encrypted send/receive in DMs and groups (webhook push + polling), signature verification on by default; undecryptable or unverified events are dropped - Webhook POSTs must carry a valid `x-twitter-webhooks-signature`, which X sends on every delivery. Set `consumerSecret` (or `X_CONSUMER_SECRET`) to receive webhooks, or `disableWebhookVerification` when an upstream layer already verifies them. Polling deployments are unaffected - Mention detection from structured mention entities, swipe-replies to the bot, and a plain-text `@handle` fallback; group replies sent as quoted replies - `openDM(userId)` starts (or reuses) an encrypted 1:1, running a full key exchange when needed so the bot can message first - Media both ways: inbound attachments with lazy download+decrypt, outbound encrypted uploads - Edit and delete of the bot's own messages; the first edit of a fresh message is age-gated by `editSafetyDelayMs` (default 5000ms) so receiving clients have stored the original - Reactions in and out, read receipts (`sendReadReceipts`, default on), typing keep-alive, configurable group welcome message - Cards degrade to text with tappable URL/mention entities plus a URL preview attachment - Requests carry a `chat-sdk-xchat/<version>` User-Agent product token so Chat SDK traffic is identifiable in X API request logs (a User-Agent set via `apiHeaders` takes precedence) - Registered in the `chat/adapters` catalog and the `create-chat-sdk` CLI scaffold, with a new optional `importPath` catalog field for adapters that ship on a subpath ## @chat-adapter/discord@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/gchat@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/github@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/linear@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/messenger@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/shared@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 ## @chat-adapter/telegram@4.36.0 ### Patch Changes -53bf73d: Preserve Telegram stable media identifiers in normalized attachment metadata and report photo attachments as JPEG. - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/twilio@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/web@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## @chat-adapter/whatsapp@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 - @chat-adapter/shared@4.36.0 ## create-chat-sdk@0.2.1 ### Patch Changes -caa6325: Add XChat support to `@chat-adapter/x`, shipped from the new `@chat-adapter/x/chat` subpath so it sits alongside the existing X adapter. The XChat crypto stack (`@xdevplatform/chat-xdk`, `@xdevplatform/xdk`, `juicebox-sdk`) is an optional peer dependency, so existing `@chat-adapter/x` users are unaffected. All cryptography is handled inside the adapter via `@xdevplatform/chat-xdk` (wasm) and all REST goes through the typed `@xdevplatform/xdk` client. Only a bot token and a Juicebox PIN are required: the bot's identity (user id and @handle) is resolved from `GET /2/users/me` at startup. - Encrypted send/receive in DMs and groups (webhook push + polling), signature verification on by default; undecryptable or unverified events are dropped - Webhook POSTs must carry a valid `x-twitter-webhooks-signature`, which X sends on every delivery. Set `consumerSecret` (or `X_CONSUMER_SECRET`) to receive webhooks, or `disableWebhookVerification` when an upstream layer already verifies them. Polling deployments are unaffected - Mention detection from structured mention entities, swipe-replies to the bot, and a plain-text `@handle` fallback; group replies sent as quoted replies - `openDM(userId)` starts (or reuses) an encrypted 1:1, running a full key exchange when needed so the bot can message first - Media both ways: inbound attachments with lazy download+decrypt, outbound encrypted uploads - Edit and delete of the bot's own messages; the first edit of a fresh message is age-gated by `editSafetyDelayMs` (default 5000ms) so receiving clients have stored the original - Reactions in and out, read receipts (`sendReadReceipts`, default on), typing keep-alive, configurable group welcome message - Cards degrade to text with tappable URL/mention entities plus a URL preview attachment - Requests carry a `chat-sdk-xchat/<version>` User-Agent product token so Chat SDK traffic is identifiable in X API request logs (a User-Agent set via `apiHeaders` takes precedence) - Registered in the `chat/adapters` catalog and the `create-chat-sdk` CLI scaffold, with a new optional `importPath` catalog field for adapters that ship on a subpath ## @chat-adapter/state-ioredis@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 ## @chat-adapter/state-memory@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 ## @chat-adapter/state-pg@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 ## @chat-adapter/state-redis@4.36.0 ### Patch Changes - Updated dependencies [257a32d] - Updated dependencies [c5d86b1] - Updated dependencies [0153a39] - Updated dependencies [b547f45] - Updated dependencies [caa6325] - chat@4.36.0 ## @chat-adapter/tests@4.36.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 |
|---|---|---|
allowedUserIds |
No | Telegram user IDs allowed to trigger the adapter. Auto-detected from TELEGRAM_ALLOWED_USER_IDS (comma-separated). All users are allowed when omitted or empty |
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_ALLOWED_USER_IDS=123456789,987654321
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 | Yes (sendDocument, sendMediaGroup) |
| Attachment uploads | Yes (sendPhoto, sendAudio, sendVideo, sendDocument, sendMediaGroup) |
| 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. - Incoming attachments preserve Telegram's downloadable
file_idand stablefile_unique_idasfetchMetadata.fileIdandfetchMetadata.fileUniqueId. Photo attachments use theimage/jpegMIME type. filesupload as Telegram documents. Multiplefilesare sent as Telegram media groups.attachmentspreserve image, audio, video, or file media type and also use media groups when multiple compatible attachments are posted. 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