How to build a Telegram bot for your business

How to build a Telegram bot for your business: plan the owner's half first, then BotFather, grammY, webhooks, data and alerts, so it stays reliable.

An ink drawing of flat building blocks arranged into a paper plane, with two loose blocks and a screwdriver beside it.

Telegram's BotFather creates a new bot and hands you its token inside a single chat, so a bot that says "hello" takes about ten minutes. A bot your team or customers rely on takes planning first, and most of that planning needs no code. This guide starts with the owner's half of the job, then hands over to whoever writes the code.

We build and run Telegram bots of our own, including an AI news digest and a fuel price bot, and we build custom bots for Singapore businesses. The steps below are the ones we follow, written so an owner can follow the first half and a developer the second.

At a glance:

  • Pick one frequent, rule-based job, and write it down on half a page.
  • Use buttons rather than typed commands, because most people never type /anything.
  • In production, use a webhook, keep the token secret and get alerted on failures.
  • Choose Telegram only when your users are happy to use it.

The owner's half of the job needs no code

Good first bots are boring on purpose

Strong first jobs for a small business include a team alert when a booking is cancelled late, a big order arrives or stock runs low. A staff request flow for class swaps, leave or purchases, with one-tap Approve, works well too. So do a sign-up bot for a members' event with limited places, a subscribed update on open slots or a timetable, and a menu that answers fixed questions.

If the job is answering walk-in customers and booking them in, they're probably messaging you on WhatsApp or your website, not Telegram. Our Telegram vs WhatsApp comparison helps you decide.

Half a page describes the whole job

Write down the trigger that starts it, the steps in order, and the rules for each decision, such as "if fewer than 3 places are left, say so". Then list the exceptions that go to a person, and what done looks like, for example "no more swap requests lost in the group chat". If you can't fill this in, the process isn't ready to automate, and sorting it out is useful anyway.

The conversation needs a sketch before the code

Write the messages the bot will send and the buttons under each, short enough to read on a phone at a bus stop. Decide what happens when someone types something unexpected. "Sorry, I didn't get that. Tap a button below, or type 'staff' to reach a person" is far better than silence.

Six build steps take the bot from BotFather to production

  1. Create the bot with BotFather

    In Telegram, open @BotFather, send /newbot, and choose a display name and a username ending in "bot". BotFather replies with a token, which you should treat like a password, because anyone with it controls your bot. Keep it out of your code and out of chats.

  2. Write a first bot in a few lines

    With Node.js installed, the grammY library gets you a working bot quickly. The full sample follows the steps.

  3. Save only what the job needs

    Once the bot collects an enquiry, a sign-up or an approval, it needs somewhere to keep it, such as a database or, for small jobs, a Google Sheet. If it's personal data, the PDPA applies, so say why you're collecting it, keep it secure and don't keep it forever.

  4. Go live with a webhook

    In production, set a webhook so Telegram pushes each update to your server instead of your bot polling for them. A small server or a serverless platform both work, and a modest bot often costs very little to host. Keep the token in your host's secret settings.

  5. Get alerted when it breaks

    Bots fail quietly. Log errors, send yourself an alert when the bot can't reach a service it depends on, and retry sensibly. Test the unhappy paths too, such as double taps, someone typing in Chinese, or a spreadsheet with an empty row.

  6. Watch real use for two weeks

    Read what people actually type and where they drop off. Most of the useful changes come from this, not from the first spec.

The step-2 sample in full.

mkdir my-business-bot &&
cd my-business-bot
npm init -y
npm install grammy

// index.js
const { Bot, InlineKeyboard }
  = require("grammy");
const bot = new Bot(
  process.env.BOT_TOKEN);

const menu =
  new InlineKeyboard()
  .text("Opening hours",
    "hours")
  .row()
  .text("Talk to a person",
    "staff");

bot.command("start", (ctx) =>
  ctx.reply(
    "Hi! What would you " +
    "like to know?",
    { reply_markup: menu }));

bot.callbackQuery("hours",
  async (ctx) => {
    await ctx
      .answerCallbackQuery();
    await ctx.reply(
      "We're open " +
      "Tue to Sun, " +
      "10am to 8pm.");
});

bot.callbackQuery("staff",
  async (ctx) => {
    await ctx
      .answerCallbackQuery();
    await ctx.reply(
      "Thanks! " +
      "Someone from the " +
      "team will reply " +
      "here soon.");
});

bot.start();

Run it with BOT_TOKEN=your-token node index.js, open your bot in Telegram and tap Start. bot.start() uses long polling, which suits testing on your own computer, and Python fans can do the same with python-telegram-bot.

Six mistakes cause most bot failures

  • Building for every possible question instead of the five common ones.
  • Text commands instead of buttons.
  • No way to reach a person.
  • The token pasted into code that ends up shared.
  • No one responsible for updating prices and answers.
  • Adding AI before the fixed answers work.

If you have a developer, the steps above will get a useful first version running. If you don't, our cost guide and hiring guide help you brief someone well.

How Furoki can help

If the bot you need is really a customer front desk that answers prices and books slots, Furoki's AI front desk already does that, so you don't have to build it. For workflows that are yours alone, we design, build and run custom bots, from the half-page brief to monitoring after launch.

Send us your half-page brief and we'll reply with an honest scope.

Keep reading

Book a consultation