mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
a5b118f1dc
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.30.0 ### Minor Changes -4c46c26: add lightweight Slack formatting primitives subpath -dbd8dc5: expose runtime-free Block Kit helpers for Slack card conversion -aba6aa9: add lightweight Slack API primitives subpath -b332a03: add lightweight Slack webhook primitives subpath -6ed4a43: add low-level Slack helpers for files, thread replies, views, interactions, and input blocks ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) -073ff92: surface Slack file upload confirmation ids in postMessage results -b63c042: fix(slack): resolve reaction user display names Slack reaction events now resolve the reacting user's display name and real name through the existing cached user lookup path. If lookup fails, the adapter falls back to the Slack user ID. -1294490: reuse low-level Slack formatting helpers in the adapter -999d268: pass the Slack bot token through native stream append and stop calls - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/telegram@4.30.0 ### Minor Changes -5461ea9: Add native Telegram private chat draft streaming with fallback streaming elsewhere. ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/twilio@4.30.0 ### Minor Changes -25ebc3b: add Twilio SMS, MMS, and voice helpers with webhook, messaging, and formatting primitives ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/whatsapp@4.30.0 ### Minor Changes -ffc43fc: Add WhatsApp typing indicator support by sending Meta's read-plus-typing payload when a recent inbound message is available. Update the default API version to v25.0. ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## chat@4.30.0 ### Minor Changes -5461ea9: Add native Telegram private chat draft streaming with fallback streaming elsewhere. ## @chat-adapter/discord@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/gchat@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) -177735a: - Fix redundant mailto link rendering in Google Chat adapter - Google Chat adapter was emitting redundant `<mailto:...|...>` tokens when rendering autolinked email addresses. This change collapses `mailto:` URLs when the visible text equals the email address, ensuring cleaner output consistent with plain text rendering in Google Chat. - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/github@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/linear@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/messenger@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/shared@4.30.0 ### Patch Changes - Updated dependencies [5461ea9] - chat@4.30.0 ## @chat-adapter/teams@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/web@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 - @chat-adapter/shared@4.30.0 ## @chat-adapter/state-ioredis@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 ## @chat-adapter/state-memory@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 ## @chat-adapter/state-pg@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 ## @chat-adapter/state-redis@4.30.0 ### Patch Changes -9b8d8c4: expand npm `keywords` for adapter and state packages to improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`, `ai-sdk`, `vercel`, plus platform-specific terms) - Updated dependencies [5461ea9] - chat@4.30.0 ## @chat-adapter/tests@4.30.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/messenger
Facebook Messenger adapter for Chat SDK, using the Messenger Platform API.
Installation
pnpm add @chat-adapter/messenger
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
License
MIT