Quick Start
Getting started with Yurst
Introduction to Yurst
Complete documentation for the Yurst library for creating bots on Node.js for the Yurba.one platform.
Yurst provides a singleton bot on which you register commands, callback buttons, and event handlers, while everything else (connection, retries, deduplication, command list synchronization) is handled by the library itself.
Requirements
Basic knowledge of JavaScript, Node.js 22 or newer, and an account on Yurba.one.
What Yurst can do
- Commands in short and object form, automatic synchronization of the list with Yurba.
- Callback buttons with simple prefix-based routing.
- Inline buttons (
data,url,copy,command) and reply keyboards. - Inline queries, message editing, typing indicator.
- Updates via WebSocket with automatic fallback to long polling.
- No runtime dependencies, ESM only.
First bot
Create a bot
Go to the developer settings, create a new bot, and save its token.
Important
Do not give anyone access to the token. Do not publish it in repositories.
Create a project
npm init -yYurst is an ESM package, so add the line "type": "module" to package.json:
{
"name": "my-bot",
"type": "module"
}Install Yurst
npm install yurst.jsAdd the token
Create a .env file in the project root:
TOKEN=b.your_bot_token
MODE=ws Do not forget to add .env to .gitignore.
Write the code
import { bot } from 'yurst.js';
bot.command('ping', 'Connection check', (ctx) => ctx.reply('pong'));
bot.command('help', 'List of commands', (ctx) => ctx.reply(ctx.help()));
await bot.start();Run the bot
node --env-file=.env src/index.jsOpen the chat with the bot on Yurba.one and send /ping. If you receive pong in response, everything works.