
Telegram Bot API — Build a Bot in 15 Minutes With Python (No Framework Needed)
Telegram bots are everywhere — from weather updates to payment processing. And building one takes 15 minutes. No framework. No library. Just the requests module and the Telegram Bot API. Step 1: Create Your Bot (2 minutes) Open Telegram, search for @BotFather Send /newbot Choose a name and username Copy the API token That is it. Your bot exists. Step 2: Send a Message import requests TOKEN = ' your_bot_token ' BASE = f ' https://api.telegram.org/bot { TOKEN } ' def send_message ( chat_id , text ): requests . post ( f ' { BASE } /sendMessage ' , json = { ' chat_id ' : chat_id , ' text ' : text , ' parse_mode ' : ' Markdown ' }) # Send to yourself (get your chat_id first) send_message ( ' YOUR_CHAT_ID ' , ' Hello from my Python bot! ' ) How to get your chat_id: Send any message to your bot, then visit: https://api.telegram.org/bot{TOKEN}/getUpdates Your chat_id is in the response. Step 3: Receive Messages (Polling) import time def get_updates ( offset = 0 ): response = requests . get ( f
Continue reading on Dev.to Python
Opens in a new tab




