English | Русский
A TypeScript framework for chatbots and voice skills. Write your conversation logic once and connect it to Telegram, VK, MAX, Viber, Yandex Alice, or Sber Salute through adapters. You can also use it with a single platform to keep conversation logic separate from its API.
English documentation · Examples · Issues
Use Node.js 22 or later for the generated project. The framework itself supports Node.js 20.20.2 or later.
Generate a TypeScript project with the CLI:
npx umbot create echo
cd echo
npm installFor a local Telegram bot, put your bot token in the generated .env file as TELEGRAM_TOKEN.
Keep this file out of version control. Replace the generated src/index.ts with:
import { Bot } from 'umbot';
import { TelegramAdapter } from 'umbot/plugins';
const bot = new Bot()
.setAppConfig({ env: './.env' })
.use(new TelegramAdapter(process.env.TELEGRAM_TOKEN));
bot.addCommand('hello', ['/start', 'hello'], (_, ctx) => {
ctx.text = 'Hello! Send me a message and I will repeat it.';
});
bot.addCommand('*', [], (_, ctx) => {
ctx.text = `You said: ${ctx.userCommand}`;
});
bot.startPolling().catch(() => {
console.error('Could not start polling. Check the bot configuration and logs.');
process.exitCode = 1;
});Build and run:
npm run build
npm startSend /start to your bot in Telegram. Long polling lets you try it locally without HTTPS or a tunnel.
If the bot already has a webhook, remove it before switching to polling.
To add umbot to an existing project:
npm install umbotSee the getting started guide for controller-based applications and webhook setup.
The framework separates your conversation from platform request and response formats:
- Shared conversation logic. Reuse command handlers across connected platforms.
- Common response components. Work with text, buttons, cards, images, audio, and TTS through one interface.
- State and storage. Use session and user data, media token caching, and database adapters.
- TypeScript tooling. Typed APIs, a project generator, adapter scaffolding, and console testing with
BotTest. - Extensible adapters and middleware. Connect another platform or database without changing the core.
- Regular expression validation. Built-in protection against unsafe command patterns.
You can keep small bots in command callbacks or use a BotController class for larger conversations.
Adding an adapter connects another platform; platform-specific features can still require separate handling.
| Platform | Adapter ID | Shared features |
|---|---|---|
| Telegram | telegram |
Text, inline and reply keyboards, photos and media groups, voice, callbacks, inline queries, message events |
| VK | vk |
Text, keyboards, carousels, voice, callback buttons |
| MAX | max_app |
Text, inline keyboards, images, audio, callbacks, bot_started deep links |
| Viber | viber |
Text, keyboards, rich media; new bots require commercial terms |
| Yandex Alice | alisa |
Skill protocol: text, TTS, buttons, cards, sounds, state, authorization |
| Sber Salute | smart_app |
SmartApp protocol: text, speech, buttons, cards, state |
| Marusia | marusia |
Skill protocol for existing skills; registration of new skills is closed |
| Your platform | Custom | Implement a platform adapter |
Telegram, VK, and MAX support both webhooks and long polling. The other built-in adapters use webhooks.
For webhook applications, use bot.start() instead of bot.startPolling().
You can test conversation logic offline with BotTest.
The shared API covers common conversation features. Polls, payments, message editing, and other platform-specific
operations are available through controller.api and platform API clients such as TelegramRequest, VkRequest,
MaxRequest, and ViberRequest from umbot/plugins. Each client also provides a generic call(method) method.
Some voice-platform directives require extending the relevant adapter.
See platform integration for supported events, configuration, and limitations.
Additional npm packages connect through bot.use(). Install database drivers and additional platform dependencies
only when you need them.
| Package | Purpose |
|---|---|
| umbot-knex-adapter | Relational databases through Knex.js: PostgreSQL, MySQL/MariaDB, SQLite, MSSQL |
| umbot-ydb-adapter | Yandex Database storage for skills and bots, including Yandex Cloud Functions |
| umbot-wechat-adapter | WeChat Official Account (Weixin) |
npm install umbot umbot-knex-adapter knex pgimport { Bot } from 'umbot';
import { TelegramAdapter } from 'umbot/plugins';
import { KnexAdapter } from 'umbot-knex-adapter';
const bot = new Bot()
.use(new TelegramAdapter(process.env.TELEGRAM_TOKEN))
.use(new KnexAdapter({ host: 'localhost', database: 'bot_db', options: { client: 'pg' } }));To build your own extension, see the platform adapter contract and database adapter contract.
The CLI generates projects and scaffolds extensions:
npx umbot add platform MyPlatform
npx umbot add db MyDatabase
npx umbot add middleware myMiddlewareGenerated platform adapters compile and include a test; implementing the actual platform API is left to you.
The CLI also provides doctor for token and webhook diagnostics and webhook for Telegram and MAX setup.
See the CLI reference.
Umbot Flow lets you design a conversation on a canvas, export flow.json, and generate
a TypeScript project:
npx umbot create from-flow flow.json --output ./my-botSee the flow format for node types and generation rules.
Benchmarks and their methodology are documented in BENCHMARKS and performance and guarantees. The core benchmarks exclude network calls and database operations. Real application throughput depends on those services and your own handlers; benchmark results are not a throughput guarantee for a deployed bot.
The English guides are machine-translated from Russian. Generated API pages still contain Russian JSDoc comments. The English README is maintained separately.
- Getting started
- Guide
- Recipes
- API reference
- Configuration and security
- HTTP client
- Middleware
- Testing
- Deployment
- FAQ
- Migration from 2.x to 3.x
- Changelog (Russian)
The Russian documentation is also available.
MIT.
Questions and suggestions: GitHub Issues or maximco36895@yandex.ru. The Telegram group and channel are primarily in Russian.