-
Notifications
You must be signed in to change notification settings - Fork 0
Home
To begin, you need to create a bot using BotFather, the official Telegram tool for managing bots.
Here are the steps:
-
Open Telegram and search for @BotFather.
-
Start a conversation with BotFather and send the following command:
/newbot -
BotFather will ask you for the following information:
- The name of your bot (e.g., MySuperBot)
- The username of your bot (must end with bot, e.g., MySuperBot_123bot)
-
Once the bot is created, BotFather will give you a token in the following format:
1234567890:ABCDefghIJKLMNOpqrstUVWXyz
To interact with your bot via a script, you need your Telegram chat ID.
Here’s how to get it:
-
Add your bot to a private chat or to a group if you want to receive notifications there.
-
Open a browser and go to the following URL, replacing YOUR_BOT_TOKEN with the token you got earlier:
https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates -
Send a message to your bot from Telegram (for example: Hello).
-
Refresh the browser page — you should see a JSON response containing a line like this:
"chat": {"id": 123456789}➡ **This number (
123456789) is your Telegram chat ID.
Create a file in $HOME/.config/.warnme
nano `$HOME/.config/.warnme`fill it with variables you got from previous steps
TELEGRAM_TOKEN=token
TELEGRAM_CHAT_ID=chat_id