NxCreateDocs

How It Works

How NxCreator runs your code, updates the bot runtime, and exposes built-in utilities.

Runtime model

Each bot runs in an isolated Node.js execution context managed by NxCreator. Your sections are evaluated into a single bot runtime, and the platform keeps the Telegram integration layer connected for you.

NxCreator runs Telegraf under the hood, but it is not a bare Telegraf setup. The distinction matters: use the built-in globals and platform patterns rather than recreating your own app bootstrap. The platform already handles connection, polling, and process management — your code only needs to describe what the bot should do.

Save cycle

When you save code, NxCreator updates the running bot definition without making you manage a separate deployment pipeline. In practice, that means faster testing: edit a handler, save, then verify the result immediately in Telegram.

Web requests

Use the global axios instance for HTTP requests. This is the standard way to call external APIs from a bot command or scene.

bot.command('news', async (ctx) => {
  try {
    const response = await axios.get('https://api.example.com/news');
    await ctx.reply('Latest news: ' + response.data.headline);
  } catch (err) {
    console.error('API request failed:', err);
    await ctx.reply('Failed to fetch news.');
  }
});

Timers & utilities

Standard timer functions such as setTimeout() and setInterval() can be used for reminders and recurring tasks inside the bot runtime.

bot.command('remindme', async (ctx) => {
  await ctx.reply('I will remind you in 5 seconds...');

  setTimeout(() => {
    ctx.reply('Reminder: 5 seconds passed!');
  }, 5000);
});

Utility modules such as crypto are also useful for app-specific logic, but keep long-running interval logic disciplined so it does not turn into unmanaged background behavior.

Last updated March 22, 2026
Was this page helpful?