기억저장소

기억저장소

카테고리 없음

How to Make a Telegram Bot (Quick Guide: bot_token, chat_id)

roaminpixel 2025. 2. 9. 16:09
728x90

These days, I am trying to make different features using ChatGPT.

When I do some work or run automation, I use a Telegram bot to send push messages.

But I often do this only once and forget about it. So, I searched the internet to do it again.

Since I have to do this anyway, I think it is better to organize everything and check my blog later. That’s why I am writing this here.

Quick Guide

To use a Telegram bot, you need bot_token and chat_id.

 

  • bot_token → Create a Telegram bot and set a unique bot name. BotFather will give you the token.
  • chat_id → Use the bot_token and request:
     
    https://api.telegram.org/bot<BOT_TOKEN>/getUpdates

 

This will return your chat_id.

 

1. Install Telegram (Windows, Mobile)

Since it's more convenient, I'll proceed with Windows.

Step 1: Download Telegram for Windows

  1. Go to the official Telegram website: https://telegram.org/apps
  2. Click the "Apps" menu at the top.
  3. Select "Telegram for Windows/Mac/Linux" (Desktop App).

Step 2: Install Telegram

  1. You will see "Get Telegram for Windows x64".
  2. Download and install it.

Now, Telegram is ready to use! 🚀

https://telegram.org/apps

 

2. Create a Telegram Bot Using BotFather

Step 1: Search for BotFather

  1. Open Telegram.
  2. Use the search bar at the top and search for BotFather.
  3. Click on BotFather (the official bot that manages other bots).

Step 2: Create a New Bot

  1. Open a chat with BotFather.
  2. Type /newbot and send it.
  3. BotFather will ask you to choose a name for your bot.
  4. Enter a name (it must end with "_bot").

    

Step 3: Get Your Bot Token

  1. After setting the bot name, BotFather will give you a bot token.
  2. Example token : "7575200005:AAH00tVR5flEWrovV4-BKzzzzzzzzzz4Zo0o 
  3. This bot token is important! Save it.

 

Step 4: Send a Message to Your Bot

  1. Open your bot’s chat by clicking the link t.me/your_bot_name.
  2. Press "Start".
  3. Type "hi" and send it.

click "t.me/test_my_bot_250209_bot
click start button
type "hi" and send it

Step 5: Get Your Chat ID

  1. Open your browser and enter this URL: https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
    (Replace <BOT_TOKEN> with your actual bot token.)
  2. If the request is successful, you will see a response like this:
     
    { "ok": true, "result": [ { "update_id": 12345678, "message": { "chat": { "id": 1990000000 }, "text": "hi" } } ] }
  3. The "chat": {"id": 1990000000} part contains your chat_id.

1. if update_id and chat_id are not visible, try typing "hi" a few more times :)
2. if update_id and chat_id are not visible, try typing "hi" a few more times :)

 

728x90
반응형