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/messenger
npm package:
@chat-adapter/messenger
Facebook Messenger adapter for Chat SDK, using the Messenger Platform API.
Documentation: chat-sdk.dev/adapters/official/messenger · Guides: vercel.com/kb/chat-sdk
Building for Instagram Direct Messages? Use
@chat-adapter/instagraminstead. It connects through Instagram API with Instagram Login and does not require a Facebook Page.
Installation
pnpm add @chat-adapter/messenger
Scaffold with the CLI
To scaffold a new Messenger bot with this adapter preselected:
npx create-chat-sdk@latest my-bot --adapter messenger memory
Visit the adapters directory to see other available official and vendor-official adapters.
Usage
import { Chat } from "chat";
import { createMessengerAdapter } from "@chat-adapter/messenger";
const bot = new Chat({
userName: "mybot",
adapters: {
messenger: createMessengerAdapter(),
},
});
bot.onDirectMessage(async (thread, message) => {
await thread.post("Hello from Messenger!");
});
When using createMessengerAdapter() without arguments, credentials are auto-detected from environment variables.
Facebook Messenger setup
1. Create a Meta app
- Go to developers.facebook.com/apps
- Click Create App
- Select the use case "Engage with customers on Messenger from Meta"
- Enter your app name and contact email, then create the app
- Go to App > App Settings > Basic and copy your App Secret — this becomes
FACEBOOK_APP_SECRET
2. Create a Facebook Page
Your Messenger bot needs a Facebook Page to send and receive messages. If you don't have one:
- The easiest approach is to create a Facebook Business profile first
- Then create a Page under that business profile
- Note the Page name — users will message this Page to interact with your bot
3. Configure Messenger API
- In your Meta app dashboard, go to Use Cases
- Find "Engage with customers on Messenger from Meta" and click Customize
- Then open Messenger API Settings
Configure webhooks
- Under Configure webhooks, click Add Callback URL
- Enter your webhook URL:
https://your-domain.com/api/webhooks/messenger - Enter a Verify Token — this is a secret string you create (this becomes
FACEBOOK_VERIFY_TOKEN) - Click Verify and Save
- After verification, click Add Subscriptions and enable:
messagesmessaging_postbacksmessaging_reactionsmessage_deliveriesmessage_reads
Generate a Page Access Token
- Under Generate access tokens, click Add or remove Pages
- Your Pages should populate — select the Page you created
- Assign the standard permissions when prompted
- Click Generate Token
- Copy the token — this becomes
FACEBOOK_PAGE_ACCESS_TOKEN
Environment variables
FACEBOOK_APP_SECRET=... # App secret from App Settings > Basic
FACEBOOK_PAGE_ACCESS_TOKEN=... # Generated Page access token
FACEBOOK_VERIFY_TOKEN=... # User-defined webhook verification secret
FACEBOOK_BOT_USERNAME=... # Optional, defaults to "messenger-bot"
FACEBOOK_API_URL=... # Optional, override the Meta Graph API base URL
Webhook setup
Messenger uses two webhook mechanisms:
- Verification handshake (GET) — Meta sends a
hub.verify_tokenchallenge that must match yourFACEBOOK_VERIFY_TOKEN. - Event delivery (POST) — incoming messages, reactions, and postbacks, verified via
X-Hub-Signature-256.
// Next.js App Router example
import { bot } from "@/lib/bot";
export async function GET(request: Request) {
return bot.webhooks.messenger(request);
}
export async function POST(request: Request) {
return bot.webhooks.messenger(request);
}
Features
Messaging
| Feature | Supported |
|---|---|
| Post message | Yes |
| Edit message | No (Messenger limitation) |
| Delete message | No (Messenger limitation) |
| Streaming | Buffered (accumulates then sends) |
| Typing indicator | Yes |
Rich content
| Feature | Supported |
|---|---|
| Card format | Generic/Button Templates |
| Buttons | Yes (max 3 per message) |
| Link buttons | Yes (web_url) |
| Select menus | No |
| Tables | Text fallback |
| Fields | Text fallback |
| Images in cards | Yes (Generic Template) |
| Modals | No |
Conversations
| Feature | Supported |
|---|---|
| Reactions | Receive only |
| Typing indicator | Yes |
| DMs | Yes (DM-only platform) |
| Postbacks | Yes |
Message history
| Feature | Supported |
|---|---|
| Fetch messages | Cached sent messages only |
| Fetch thread info | Yes |
Interactive messages
Card elements are automatically converted to Messenger templates:
- Generic Template — Used when the card has a
titleorimageUrl. Supports up to 3 buttons. - Button Template — Used when the card has text content and buttons but no title/image. Max 640 characters.
- Text Fallback — Used when the card contains unsupported elements (tables, select menus) or exceeds constraints.
Template constraints:
- Maximum 3 buttons per template
- Button titles limited to 20 characters (truncated with ellipsis)
- Subtitles limited to 80 characters
- Button Template text limited to 640 characters
Thread ID format
messenger:{recipientId}
Example: messenger:27161130920158013
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