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/gchat@4.37.0 ### Minor Changes -c3b5a08: Bind Pub/Sub push verification to a specific identity with the new pubsubServiceAccountEmail option, alongside the existing audience check. Pushes are rejected unless the token email matches it. Direct webhooks are unaffected. -7a19223: Bind Workspace Add-on webhook verification to a specific identity with the new `workspaceAddOnServiceAccountEmail` option, replacing a pattern match on the add-on service account email. Workspace Add-on Chat apps must set it; standalone Chat apps are unaffected. ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/instagram@4.37.0 ### Minor Changes -2a2b2c5: Add a native Instagram Direct Messages adapter with signed webhooks, media, quick replies, story context, reactions, and typed Meta API errors. ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/notion@4.37.0 ### Minor Changes -0ec6a73: Add `@chat-adapter/notion` for Notion page and block comment discussions: webhook HMAC verification, Post+Edit streaming, conversation history, `message.subject` page metadata, plain-text `@userName`/`@botUserId` mention detection, and File Uploads (up to 3 native attachments). Registers the adapter in the `chat/adapters` catalog and `create-chat-sdk` CLI scaffold, and adds Notion emoji platform support. ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/slack@4.37.0 ### Minor Changes -4ac0455: Add message update and delete lifecycle callbacks, with Slack message_changed and message_deleted dispatch support. ### Patch Changes -6f0d2f0: Resolve outgoing @name mentions on the Slack native streaming path so streamed responses mention users consistently with the post-and-edit fallback. Committed renderer text is resolved incrementally, keeping fenced code literal and preserving the existing ambiguity semantics. -4cc3445: Bound the length of bracketed URLs parsed from message text in the link-unfurl fallback, avoiding a quadratic scan on adversarial input. Valid links are unaffected. -c311827: Preserve the Slack channel ID when converting labeled channel tokens (`<#C123|general>` now becomes `#general (C123)`) so agents can pass the ID to channel tools, and normalize the commonly hallucinated `<label|url>` link order before Markdown conversion - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/whatsapp@4.37.0 ### Minor Changes -6abf480: Add native WhatsApp LinkButton support - A card whose only interactive element is a single `LinkButton` with a non-empty label and an `http://` or `https://` URL is now sent as a native `cta_url` interactive message, as long as the card has no header image or image, table, chart, or inline link children and the post carries no files or attachments. - Link button URLs are now appended as `Label: url` lines to interactive button message bodies and to media captions, instead of being dropped. - Everything else is unchanged: non-matching cards keep the formatted text fallback, and card + media posts keep the single captioned media send. -16879fd: Fix the `WhatsAppInboundMessage.context` type to model all documented webhook variants. The type previously declared `context?: { from: string; id: string }`, but Meta's Cloud API sends mutually exclusive context shapes: quoted replies carry `from`/`id`, forwarded messages carry only `forwarded` or `frequently_forwarded` (no `id`), and catalog product inquiries add `referred_product`. Code narrowed by the old type could dereference `context.id` and crash at runtime on forwarded messages. All context fields are now optional and the forwarded/product-inquiry fields are included. Consumers that dereference `context.from` or `context.id` without a guard will now see a type error, surfacing what was already a latent crash on forwarded messages. ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## chat@4.37.0 ### Minor Changes -2a2b2c5: Add a native Instagram Direct Messages adapter with signed webhooks, media, quick replies, story context, reactions, and typed Meta API errors. -4ac0455: Add message update and delete lifecycle callbacks, with Slack message_changed and message_deleted dispatch support. -0ec6a73: Add `@chat-adapter/notion` for Notion page and block comment discussions: webhook HMAC verification, Post+Edit streaming, conversation history, `message.subject` page metadata, plain-text `@userName`/`@botUserId` mention detection, and File Uploads (up to 3 native attachments). Registers the adapter in the `chat/adapters` catalog and `create-chat-sdk` CLI scaffold, and adds Notion emoji platform support. -85e3d22: Close residual gaps in agent read-tool scoping. `createChatTools`'s read guard now wraps modal, assistant-thread, assistant-context, app-home, app-context, and member-joined dispatch so tools built in those handlers inherit the active conversation, and it logs a warning (instead of failing open silently) when a read runs with no resolvable scope. Scoping stays channel-level by default, so a thread scope still permits sibling threads in its channel. Pass the new `strictScope: true` to confine a thread scope to that thread alone, rejecting both sibling threads and the parent channel, which matters on platforms where a channel is the widest read available (a GitHub channel is an entire repo). Note that reads inside those newly wrapped handlers were previously unscoped. An agent built in an `onModalSubmit`, `onAppHomeOpened`, or `onMemberJoinedChannel` handler that reads another channel will now be rejected. Pass an explicit `scope`, or `scope: false` for intentionally workspace-wide reads. ## create-chat-sdk@0.3.0 ### Minor Changes -2a2b2c5: Add a native Instagram Direct Messages adapter with signed webhooks, media, quick replies, story context, reactions, and typed Meta API errors. -0ec6a73: Add `@chat-adapter/notion` for Notion page and block comment discussions: webhook HMAC verification, Post+Edit streaming, conversation history, `message.subject` page metadata, plain-text `@userName`/`@botUserId` mention detection, and File Uploads (up to 3 native attachments). Registers the adapter in the `chat/adapters` catalog and `create-chat-sdk` CLI scaffold, and adds Notion emoji platform support. ## @chat-adapter/discord@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/github@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/linear@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/messenger@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/shared@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 ## @chat-adapter/teams@4.37.0 ### Patch Changes -4cc3445: Harden Teams HTML-to-text conversion to strip tags until the output is stable, so nested or malformed markup can't leave a partial tag behind. `stripHtmlTags` is now shared across the format and Graph message converters. - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/telegram@4.37.0 ### Patch Changes -629e655: Combine incoming Telegram media groups into one message with ordered attachments and the shared caption. - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/twilio@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/web@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/x@4.37.0 ### Patch Changes -b674923: Restrict the X CRC challenge to the opaque token shape X sends before signing it. The endpoint previously returned an HMAC over any `crc_token`, which let a caller have an arbitrary webhook body signed and replay that as `x-twitter-webhooks-signature` on a forged POST. A webhook body is JSON and can no longer pass the token check, so a CRC response can't double as a POST event signature. - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 - @chat-adapter/shared@4.37.0 ## @chat-adapter/state-ioredis@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 ## @chat-adapter/state-memory@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 ## @chat-adapter/state-pg@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 ## @chat-adapter/state-redis@4.37.0 ### Patch Changes - Updated dependencies [2a2b2c5] - Updated dependencies [4ac0455] - Updated dependencies [0ec6a73] - Updated dependencies [85e3d22] - chat@4.37.0 ## @chat-adapter/tests@4.37.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/teams
npm package:
@chat-adapter/teams
Microsoft Teams adapter for Chat SDK.
Documentation: chat-sdk.dev/adapters/official/teams · Guides: vercel.com/kb/chat-sdk
Installation
pnpm add @chat-adapter/teams
Scaffold with the CLI
To scaffold a new Microsoft Teams bot with this adapter preselected:
npx create-chat-sdk@latest my-bot --adapter teams memory
Visit the adapters directory to see other available official and vendor-official adapters.
Usage
The adapter auto-detects TEAMS_APP_ID, TEAMS_APP_PASSWORD, and TEAMS_APP_TENANT_ID from environment variables:
import { Chat } from "chat";
import { createTeamsAdapter } from "@chat-adapter/teams";
const bot = new Chat({
userName: "mybot",
adapters: {
teams: createTeamsAdapter({
appType: "SingleTenant",
}),
},
});
bot.onNewMention(async (thread, message) => {
await thread.post("Hello from Teams!");
});
Bot setup
The Teams CLI handles AAD app registration, client secret generation, bot registration, and Teams channel setup in one command.
npm install -g @microsoft/teams.cli
1. Create the app
teams login
teams status # verify auth + sideloading permissions
teams app create --name "My Bot" --endpoint "https://your-domain.com/api/webhooks/teams" --env .env
Tip
For local development, use a tunnel (e.g. devtunnel, ngrok) to expose your local server.
Credentials (CLIENT_ID, CLIENT_SECRET, TENANT_ID) are written to .env. Rename them to match the adapter:
TEAMS_APP_ID=<CLIENT_ID>
TEAMS_APP_PASSWORD=<CLIENT_SECRET>
TEAMS_APP_TENANT_ID=<TENANT_ID>
2. Install in Teams
Get a direct install link:
teams app get <appId> --install-link
Or download the app package for sideloading:
teams app package download <appId> -o my-bot.zip
Then in Teams: Apps > Manage your apps > Upload an app > Upload a custom app.
3. Verify
teams app doctor <appId>
Checks bot registration, AAD app health, manifest consistency, and endpoint reachability.
Configuration
All options are auto-detected from environment variables when not provided. Internally, the adapter maps these options to the Teams SDK (@microsoft/teams.apps).
| Option | Required | Description |
|---|---|---|
appId |
No* | Azure Bot App ID. Auto-detected from TEAMS_APP_ID |
appPassword |
No** | Azure Bot App Password. Auto-detected from TEAMS_APP_PASSWORD |
federated |
No** | Federated (workload identity) authentication config |
appType |
No | "MultiTenant" or "SingleTenant" (default: "MultiTenant") |
appTenantId |
For SingleTenant | Azure AD Tenant ID. Auto-detected from TEAMS_APP_TENANT_ID |
userName |
No | Bot display name (default: "bot") |
apiUrl |
No | Override the Teams API base URL (e.g. for GCC-High or sovereign-cloud deployments). Auto-detected from TEAMS_API_URL |
logger |
No | Logger instance (defaults to ConsoleLogger("info")) |
*appId is required — either via config or TEAMS_APP_ID env var.
**Exactly one authentication method is required: appPassword or federated. When neither is provided, TEAMS_APP_PASSWORD is auto-detected from environment.
Authentication methods
The adapter supports two authentication methods. When no explicit auth is provided, TEAMS_APP_PASSWORD is auto-detected from environment variables.
Client secret (default)
The simplest option — provide appPassword directly or set TEAMS_APP_PASSWORD:
createTeamsAdapter({
appPassword: "your_app_password_here",
});
Federated (workload identity)
For environments with managed identities (e.g. Azure Kubernetes Service, GitHub Actions). Maps to managedIdentityClientId in the Teams SDK:
createTeamsAdapter({
federated: {
clientId: "your_managed_identity_client_id_here",
},
});
Environment variables
TEAMS_APP_ID=...
TEAMS_APP_PASSWORD=...
TEAMS_APP_TENANT_ID=... # Required for SingleTenant apps
TEAMS_API_URL=... # Optional, for GCC-High or sovereign-cloud deployments
Features
Messaging
| Feature | Supported |
|---|---|
| Post message | Yes |
| Edit message | Yes |
| Delete message | Yes |
| File uploads | Yes |
| Streaming | Native (DMs) / Buffered fallback (group chats) |
Rich content
| Feature | Supported |
|---|---|
| Card format | Adaptive Cards |
| Buttons | Yes |
| Link buttons | Yes |
| Select menus | No |
| Tables | GFM |
| Fields | Yes |
| Images in cards | Yes |
| Modals | Yes |
Conversations
| Feature | Supported |
|---|---|
| Slash commands | No |
| Mentions | Yes |
| Add reactions | Yes |
| Remove reactions | Yes |
| Receive reactions | Yes |
| Typing indicator | Yes |
| DMs | Yes |
| Ephemeral messages | Yes (native targeted messages, public preview) |
User lookup (getUser) |
Yes (requires User.Read.All) |
Message history
| Feature | Supported |
|---|---|
| Fetch messages | Yes (requires Graph permissions) |
| Fetch single message | No |
| Fetch thread info | Yes |
| Fetch channel messages | Yes (requires Graph permissions) |
| List threads | Yes (requires Graph permissions) |
| Fetch channel info | Yes (requires Graph permissions) |
| Post channel message | Yes |
Conversation routing
Incoming thread IDs preserve the Teams conversation type when the legacy ID-prefix heuristic would route it incorrectly. This keeps correctly classified IDs stable while selecting the buffered fallback for group chats whose IDs begin with a:. Thread IDs created by older adapter versions remain supported.
Incoming attachments
Incoming inline images and files are exposed through message.attachments with a lazy fetchData() method. The adapter authenticates connector-hosted inline attachments through the configured Teams bot client, while Teams file download cards use their direct download URL without the bot token.
User lookup (getUser)
The adapter supports looking up user profiles via the Microsoft Graph API. To enable it:
- Grant the
User.Read.Allapplication permission in your Azure AD app registration - Grant admin consent for the permission
const user = await bot.getUser(message.author);
console.log(user?.email); // "alice@contoso.com"
console.log(user?.fullName); // "Alice Smith"
Incoming message authors also include email when Graph resolves the sender. The adapter uses the activity's Azure AD object ID first and falls back to its cached ID, so missing permissions or lookup failures leave message.author.email undefined without preventing message delivery. This applies to live incoming messages only — authors on edited-message events and messages returned by fetchMessages are not hydrated with an email. Resolved profiles are cached in the state adapter for 1 hour (failed lookups for 5 minutes), so busy conversations don't trigger a Graph call per message.
The adapter caches each user's Azure AD object ID from incoming activities for later getUser calls. getUser returns null if the user hasn't been seen or the Graph call fails.
Targeted / ephemeral messages
Teams targeted messages are available in public preview. Use the standard Chat SDK postEphemeral API to send a message that is visible only to a specific Teams conversation member:
await thread.postEphemeral(message.author, "Only you can see this.", {
fallbackToDM: false,
});
The adapter sends these natively with Teams targeted message metadata. usedFallback is false when the Teams API accepts the message.
Message history (fetchMessages)
Fetching message history requires TEAMS_APP_TENANT_ID and the right permissions depending on the conversation type:
| Context | Permission | Type | Admin consent? |
|---|---|---|---|
| Channel | ChannelMessage.Read.Group |
RSC | No |
| Group chat | ChatMessage.Read.Chat |
RSC | No |
| DM | Chat.Read.All |
Azure AD | Yes |
RSC permissions are set via the Teams CLI (no admin consent needed):
teams app rsc add <appId> ChannelMessage.Read.Group --type Application
teams app rsc add <appId> ChatMessage.Read.Chat --type Application
For DM message history, RSC is not sufficient. Add the Chat.Read.All Azure AD permission using the Azure CLI:
az ad app permission add \
--id <appId> \
--api 00000003-0000-0000-c000-000000000000 \
--api-permissions 6b7d71aa-70aa-4810-a8d9-5d9fb2830017=Role
az ad app permission admin-consent --id <appId>
Without any of these permissions, fetchMessages will throw a NotImplementedError.
Receiving all messages
By default, Teams bots only receive messages when directly @-mentioned. The RSC permissions above (ChannelMessage.Read.Group and ChatMessage.Read.Chat) also enable receiving all messages in channels and group chats as a side effect.
Troubleshooting
Run teams app doctor <appId> to diagnose common issues — it checks bot registration, AAD app health, manifest consistency, and endpoint reachability.
"Unauthorized" error
- Verify
TEAMS_APP_IDand your chosen auth credential are correct - For client secret auth, check that
TEAMS_APP_PASSWORDis valid and not expired - For federated auth, verify the managed identity client ID is correct and that federated credentials are configured in Azure AD
- For SingleTenant apps, ensure
TEAMS_APP_TENANT_IDis set - Check that the messaging endpoint URL is correct in Azure
Bot not appearing in Teams
- Verify the Teams channel is enabled in Azure Bot
- Check that the app manifest is correctly configured
- Ensure the app is installed in the workspace/team
Messages not received
- Verify the messaging endpoint URL is correct
- Check that your server is accessible from the internet
- Review Azure Bot logs for errors
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