This guide explains how to create a Telegram bot and retrieve the required Bot API Token and Chat ID for sending messages from PowerShell.
- Open Telegram
- Search for @BotFather
- Start a chat and run:
/start- Create a new bot:
/newbot- Enter:
- Bot name (example:
PRTGGraphAutomation) - Bot username (must end with
bot)PRTGGraphAutomationbot
- BotFather will return a token:
123456789:AAE_xxxxxxxxxxxxxxxxxxxxx
📌 Save this token securely
This is your Telegram Bot API Token.
- Open your bot using:
https://t.me/<your_bot_username>- Click Start
- Create a Telegram group or channel
- Add your bot to the group
- (Recommended) Promote bot to Admin
- Required for sending messages in groups/channels
- Send any message to the bot:
hello
- Open in browser:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
- Look for:
"chat": {
"id": -1001234567890,
"type": "group",
"title": "PRTG Alerts"
}📌 Chat ID examples
- Personal chat: 123456789
- Group / Channel: -1001234567890
🔒 Security Best Practices
- Rotate token if exposed
- Use private repos for production automation
- Restrict bot to required groups only