JavaScript Bots

Build Telegram bots in JavaScript with the NxCreator managed runtime.

JavaScript is the default NxCreator runtime. Write Telegraf-style handlers in the live editor and let the platform handle hosting, webhooks, and process management.

JavaScript bots on NxCreator

Every JavaScript bot receives a pre-initialized bot object, a scoped db helper, and axios for outbound HTTP. You focus on commands, scenes, and data flows; NxCreator owns the runtime wiring.

Handlers use the familiar Telegraf API: bot.command(), bot.hears(), bot.action(), and bot.on(). Save a change and the managed runtime reloads it immediately.

Runtime & sandbox

Each bot runs in an isolated Node.js execution context. The runtime is hardened and managed for you, including webhook lifecycle, restarts, and Telegram API connectivity. Memory-only state does not survive restarts, so use the database or scenes for durable state.

Rich & new Telegram methods

The JavaScript runtime exposes current Bot API features, including premium emoji, inline keyboards, rich formatting, and Telegram Stars invoices.

javascript
// Premium emoji in a message
await ctx.reply('Hello 👋', { parse_mode: 'HTML' });

// Premium emoji in an inline keyboard
await ctx.reply('Pick one:', {
  reply_markup: {
    inline_keyboard: [[
      { text: '⭐ Premium', callback_data: 'premium' }
    ]]
  }
});

// Telegram Stars invoice
await ctx.replyWithInvoice({
  title: 'Pro plan',
  description: 'Monthly subscription',
  payload: 'pro-monthly',
  currency: 'XTR',
  prices: [{ label: 'Pro', amount: 100 }]
});

Start building

Continue with the Quick Start, learn the bot object, or go deeper with commands, scenes, and the database.

Building in Python instead? Open the Python docs →

Was this page helpful?
Last updated March 22, 2026