Intro to Telegram Bots

Are you looking for an easy way to get started with Telegram bots? This guide will walk you through the fundamental steps to create your very first Telegram bot using @BotFather, The official bot management tool provided by Telegram.

Prerequisites

Before we dive in, here’s what you’ll need:

  • A Telegram account (mandatory)

  • If you plan to build or code the bot:

    Node.js and npm installed on your system

Note: If your only goal is to create and register a bot without any backend development, then just having a Telegram account is enough.

Open your Telegram app (mobile or web) and type BotFather in the search bar.

The official BotFather account has 3M+ users, make sure you select the verified one to avoid confusion.

Step 2: Start the Chat

When you first open the chat, you’ll see a blue “Start” button at the bottom.

  • Tap on it to initiate the conversation.

  • BotFather will greet you with a welcome message and display a list of available commands.

Step 3: Use the /newbot Command

Type or tap /newbot to begin creating your new bot.

BotFather will respond with a message prompting you to choose a name and username for your bot.

Step 4: Choose a Display Name for Your Bot

BotFather will first ask you to choose a display name. This is the name that users will see, be creative and choose something relevant or catchy.

Step 5: Choose a Unique Username

Next, you'll be prompted to select a username for your bot. This is more strict and must follow these rules:

  • Must be unique (not already taken)

  • Must end with the word bot (e.g., CryptoTrackerBot)

  • Only alphanumeric characters and underscores are allowed

Done!

Congratulations, you've successfully created your first Telegram bot!

After completion, you'll receive a bot token similar to this format:

7806969817:AAGnq2Vqt56FGwxFrJQBo9K6PdNdwT4vsVo (Don’t worry, this is a dummy token and will be regenerated.)

Copy and store this token safely, as you'll need it to interact with Telegram’s Bot API.

In the next article, we’ll explore how to connect this bot using Telegraf.js, a powerful Node.js framework for building Telegram bots.

Why this token is important

The bot token provided by BotFather is a critical authentication key that allows your server or application to communicate securely with the Telegram Bot API.

it authorizes any interaction between your backend code and Telegram’s servers.

Never share your bot token publicly. If someone else gains access to it, they can control your bot, send spam, or impersonate you. Treat it with the same caution you would apply to an API key or a system password.

If your token is ever compromised, you can regenerate it instantly via BotFather using the /revoke command and generate a new one using /token.

Consider subscribing to my newsletter to stay updated on future guides and tutorials!

10
Subscribe to my newsletter

Read articles from Ismail Bin Mujeeb directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ismail Bin Mujeeb
Ismail Bin Mujeeb