Which tool to choose

Telegram and WhatsApp look similar, but for someone starting from scratch they're two worlds.

  • Telegram: open. You create a bot in five minutes, for free, and the AI writes you the program that makes it work. It's the right choice for learning, for a personal bot, for automating alerts to a group.
  • WhatsApp: closed. You can't connect a bot to your personal number: it takes a WhatsApp Business account approved by Meta and an external provider. The realistic route for someone who doesn't code is a paid visual builder where you compose the responses by dragging blocks, without writing code.

If the goal is to understand how a bot works, start from Telegram: the cost is zero and the AI explains the code to you. Move to WhatsApp only when you need to reach customers who are there, and budgeting for a monthly expense.

How to do it

This is the procedure for Telegram, the only one really within reach without spending.

  1. Open Telegram, search for the user @BotFather (it's the official bot that creates the other bots, it has the blue checkmark). Write it /newbot.
  2. It asks you for a name and then a username that must end in bot (for example shop_alerts_bot). At the end it hands you a long line of letters and numbers: that's the token, your bot's secret key. Keep it like a password.
  3. On your computer you need Python installed (a free programming language; search for "install Python" on the official site python.org and follow the installer). Then open the terminal (the window where you type commands: on Windows it's called "Command Prompt", on Mac "Terminal") and install the library that talks to Telegram:
pip install python-telegram-bot
  1. Have the AI write the script. The operating syntax:
I don't code. Write me a complete Python script with the
python-telegram-bot library that, when someone writes /start to my bot,
replies "Hi, I'm the shop bot". Put the token at the top
with a comment that says where to paste it. Explain to me line by line
how I launch it.
  1. Save the text the AI gives you in a file with the .py extension (for example bot.py), paste your token in the indicated place, and launch it from the terminal with python bot.py. The basic script is this:
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes

# Paste here inside the quotes the token BotFather gave you:
TOKEN = "INCOLLA_QUI_IL_TUO_TOKEN"

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text("Ciao, sono il bot del negozio")

app = Application.builder().token(TOKEN).build()
app.add_handler(CommandHandler("start", start))
app.run_polling()   # keeps the bot listening: leave the window open
  1. Check: open Telegram, search for your bot by its username and write it /start. If it replies, it works. As long as the terminal window stays open, the bot is alive; when you close it, it stops.

A concrete example

Luca coaches a five-a-side football team and gets tired of sending the training schedule to the group by hand. He creates allenamenti_bot with BotFather, asks the AI to add to the basic script an /orario command that replies with a fixed day and time. The AI gives him back six extra lines:

from telegram.ext import CommandHandler

async def orario(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text("Allenamenti: martedì e giovedì, ore 20:30")

app.add_handler(CommandHandler("orario", orario))   # goes before run_polling()

Luca pastes, relaunches, writes /orario in the group and the bot replies to everyone. To keep it on when he turns off the computer he'll have to move it to an always-on service, but to try it his laptop is enough.

When it does NOT work (and how to fix it)

If the bot doesn't reply to /start

Almost always the token is pasted wrong: an extra space, missing quotes, or you pasted only half the line. Recopy the token from BotFather (you can ask it again with /mybots) and paste it whole between the quotes. Also check that the terminal window is still open and isn't showing a red error: if it is, paste it to the AI.

If the terminal gives "ModuleNotFoundError: No module named 'telegram'"

It means the library isn't installed in the right environment. Relaunch pip install python-telegram-bot in the same window where you launch the script. If it persists, paste the full error to the AI writing "it can't find the telegram library, how do I install it correctly".

If you want a WhatsApp bot and are looking for code to copy

You won't find it working for your personal number: Meta doesn't allow it. Stop looking for scripts and choose a visual chatbot builder for WhatsApp Business. There you connect a dedicated number, compose the responses in blocks and pay a fee. Do-it-yourself with code, on WhatsApp, is a closed road for anyone without an approved business account.

If the Telegram bot works but turns off when you close the computer

It's normal: the script runs as long as your computer runs. To keep it always on you need to put it on a small server that doesn't shut down. Ask the AI "how do I keep my Telegram bot on 24 hours a day without leaving the PC on" and it'll list the free or nearly free services suitable for a small bot.

A tip from someone who actually uses it

Keep the token out of conversations and out of any public place. Whoever gets your token controls your bot: they can reply to your users in your place. If by mistake you paste it in a shared chat or publish it, go straight to BotFather, write /revoke and have a new one issued. The old one stops working instantly.

Frequently asked questions

How much does it really cost?

Telegram: zero, both the bot and the library. The only possible cost is keeping it always on on a server, but for a small bot there are free plans. WhatsApp: you always pay, between the builder's fee and the cost of the messages sent. That's why, for learning, Telegram has no rivals.

Do I have to know how to code to change it later?

No, but you have to know how to dialogue with the AI. Every time you want a new feature ("also reply to /aiuto", "send the alert every Monday") you describe it in words, paste the current script and ask for the updated version. The code stays something you read and paste, not something you write.

Can my bot reply like an AI, not just with fixed phrases?

Yes, but it's one step more: the Telegram bot forwards the user's message to an AI model and returns its reply. It takes a second key, that of the AI service, and almost always you pay per use. Start with the fixed replies: when you master them, ask the AI how to connect the bot to a conversational model.

So the "free and easy" WhatsApp bot advertised everywhere is a lie?

It's a half-truth worth dismantling. Those services are genuinely easy, but "free" only applies to the trial: as soon as you connect a real number and send messages to customers, Meta's costs kick in for every conversation. Nobody gives away access to the WhatsApp channel. Anyone who promises a complete WhatsApp bot at zero cost is selling you the trial plan, not the service.