Vercel Chat SDK adds Telegram adapter, now supports five messaging platforms
Telegram Adapter Now Available
Vercel's Chat SDK has expanded its multi-platform support to include Telegram, allowing developers to build bots that work seamlessly across five messaging platforms using a unified codebase. This addition maintains the SDK's philosophy of write-once, deploy-everywhere functionality.
Key Features
The Telegram adapter supports:
- Message interactions: Mentions, reactions, and direct messages
- Real-time feedback: Typing indicators
- Rich content: Text cards with buttons and link buttons that render as inline keyboard elements
- File handling: Single file uploads
Getting Started
Setting up a Telegram bot requires minimal configuration:
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}`);
});
Important Limitations
Developers should be aware of Telegram's platform constraints:
- Message history: Not exposed via full APIs; the adapter uses caching at the adapter level
- Callback data: Limited to 64 bytes
- Unsupported features: Modals and ephemeral messages are not currently available
For complete implementation details and best practices, see the official documentation.