Create a Telegram Bot and Get the Token
< 1 мин. чтения
🤖 How to Create a Telegram Bot and Get the Token #
- Open the Telegram app on your phone or computer.
- Search for @BotFather — this is the official bot for creating other bots.
- Click the Start button or enter the command:
/start
- Enter the command:
/newbot
- Choose a name for your bot (any name, e.g., DEXBot).
- Then enter a username for your bot — it must be in English and end with
bot(e.g.,dexbot_helper_bot). - After that, BotFather will send you an access token (API key) — it looks like this:
1234567890:AAH9_q2ZzQwz3D5vGJ0EXAMPLEu1lA
- Copy this token and keep it safe — this is what you insert into the
.envfile to run your Telegram bot.
🗒️ Example: .env structure #
TELEGRAM_TOKEN=1234567890:AAH9_q2ZzQwz3D5vGJ0EXAMPLEu1lA
⚠️ Important #
- Do not publish the token publicly (e.g., on GitHub).
- If the token is compromised, open BotFather and use the /revoke command to generate a new one.