Create Telegram Bot programmatically without BotFather

I’m wondering if there’s a way to programmatically create Telegram bots without going through BotFather. My use case is that when users register on my platform, I want to automatically generate a personal bot for each of them.

I’ve been experimenting with a Node.js Telegram library, but I’m stuck on the phone verification step. Here’s what I’m working with:

const { TelegramAPI } = require('telegram-api-client');
const { Session } = require('telegram-api-client/sessions');
const readline = require('readline');

class BotGenerator {
  constructor() {
    this.appId = process.env.TELEGRAM_APP_ID;
    this.appSecret = process.env.TELEGRAM_APP_SECRET;
    this.session = new Session('');
  }

  async generateBot() {
    const telegramAPI = new TelegramAPI(this.session, this.appId, this.appSecret, {
      retries: 3,
    });

    await telegramAPI.connect({
      phone: '+1234567890',
      verificationCode: async () => {
        const rl = readline.createInterface({
          input: process.stdin,
          output: process.stdout
        });
        return new Promise(resolve => {
          rl.question('Please enter verification code: ', answer => {
            rl.close();
            resolve(answer);
          });
        });
      },
      errorHandler: err => {
        console.error('Connection failed:', err);
      },
    });

    console.log('Successfully connected to Telegram');
    await telegramAPI.sendText('self', 'Bot creation test message');
  }
}

The main issue is that verification code prompt - it blocks the automated process. Is there any way to bypass this verification step or use a different approach that doesn’t require manual intervention? I need this to work completely automatically when users sign up.

Nope, there’s no legit way around BotFather for creating Telegram bots. That phone verification you’re hitting? That’s for regular user accounts, not bots. You’re basically trying to authenticate as a normal user, which will always need manual verification.

I ran into this same issue last year. My solution? Skip the individual bots entirely. I built one main bot that handles everyone and used a database to track each user’s settings and responses. Way more scalable and you won’t hit rate limits. Just store user preferences and customize responses - feels personalized without the headache.

BotFather’s still the only official way to make actual bots. Try to bypass their verification and you’ll probably lose API access.

This breaks Telegram’s ToS anyway. Phone verification isn’t supposed to be automated - it’s a security feature. Even if you find a workaround, Telegram will catch on and ban your entire setup. Just use one bot with user contexts like the other person suggested.

I tried this a few months ago and went down the same rabbit hole before hitting a wall. You can’t do what you’re trying to do with the Telegram API client - you’re creating regular user accounts, not bots. That’s why you keep hitting phone verification. You can’t bypass that step since it’s baked into Telegram’s security. Even if you could automate it, you’d need unique phone numbers for each bot, which gets expensive fast and doesn’t scale. Scrap this approach entirely. Build one bot that acts as a router instead. Use webhook URLs with user-specific parameters or set up a conversation state system that personalizes each interaction. Way cleaner and you can actually maintain it long-term.