How to create a Telegram bot with Python?

Hi Everyone,

I am sure you all have used Telegram bots for multiple tasks, from YouTube downloaders to Group moderator bots.

Here I am going to explain how you can make your own Telegram bot with Python.

It’s an in-depth tutorial exclusively for onehack members.

Let’s start…

First of all we need a Telegram bot to program. So, let’s create a telegram bot.

Part 1: Creating Telegram bot

Follow the steps below to create a Telegram bot.

  1. Go to @botfather in Telegram app

  2. Start the BotFather bot

  3. Send /newbot to BotFather

  4. Give a name to the bot

  5. Choose a username for your bot that end with bot

  6. Keep the Token sent by BotFather at a safe place

Part 2: Program your Telegram Bot in Python

To work with your Telegram Bot you need to follow the steps below.

  1. Install Python 3 for Your PC
  2. Install Git Bash
  3. Install pyTelegramBotApi module by either pip or manually downloading
  4. import telebot and start writing the program

Some Basic Examples of Bots you can begin with in Python:

  1. RSSFeed Bot(using feedparser module)
  2. Currency Converter bot

Thanks & Regards,
Abhishek Verma

Any questions? Ask me questions in replies or Twitter.

5 Likes