Most developers overcomplicate notifications. They set up Slack webhooks, email services, PagerDuty integrations. For side projects and personal tools, Telegram is simpler, faster, and free.
Here is how I set it up in 5 minutes.
Step 1: Create a Bot (2 minutes)
- Open Telegram, search for
@BotFather - Send
/newbot - Choose a name and username
- Copy the token (looks like
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
That is it. No OAuth, no API keys, no dashboard.
Step 2: Get Your Chat ID (1 minute)
Send any message to your new bot, then:
curl -s "https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates" | jq '.result[0].message.chat.id'
Save this number. You will use it to send messages to yourself.
Step 3: Send a Message (30 seconds)
curl -s -X POST "https://api.telegram.org/bot<TOKEN>/sendMessage" \
-d "chat_id=<CHAT_ID>" \
-d "text=Hello from my script!"
You will get a Telegram notification instantly. No email delays, no spam folders.
Python Wrapper (10 lines)
import httpx
import os
BOT_TOKEN = os.environ["TG_BOT_TOKEN"]
CHAT_ID = os.environ["TG_CHAT_ID"]
def notify(message: str, parse_mode: str = "HTML"):
httpx.post(
f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage",
json={"chat_id": CHAT_ID, "text": message, "parse_mode": parse_mode}
)
5 Real Use Cases
1. Scraper Monitoring
import time
start = time.time()
data = run_scraper()
elapsed = time.time() - start
notify(f"<b>Scraper done</b>\nItems: {len(data)}\nTime: {elapsed:.1f}s")
2. Server Health Check
#!/bin/bash
# Run via cron every 5 minutes
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://yoursite.com)
if [ "$STATUS" != "200" ]; then
curl -s -X POST "https://api.telegram.org/bot$TG_TOKEN/sendMessage" \
-d "chat_id=$TG_CHAT_ID&text=ALERT: Site returned $STATUS"
fi
3. GitHub Actions Notification
- name: Notify on failure
if: failure()
run: |
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TG_TOKEN }}/sendMessage" \
-d "chat_id=${{ secrets.TG_CHAT_ID }}&text=CI Failed: ${{ github.repository }}"
4. Price Alert
import httpx
price = httpx.get("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd").json()
btc = price["bitcoin"]["usd"]
if btc > 100000:
notify(f"BTC above $100K: ${btc:,.0f}")
5. Daily Summary
from datetime import datetime
stats = get_daily_stats()
notify(f"""<b>Daily Report — {datetime.now().strftime('%Y-%m-%d')}</b>
Users: {stats['users']}
Revenue: ${stats['revenue']:.2f}
Errors: {stats['errors']}
""")
Advanced: Formatting and Media
# Send with buttons
httpx.post(f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage", json={
"chat_id": CHAT_ID,
"text": "New deploy ready for review",
"reply_markup": {
"inline_keyboard": [[
{"text": "View PR", "url": "https://github.com/you/repo/pull/1"},
{"text": "View Logs", "url": "https://logs.example.com"}
]]
}
})
# Send a file
with open("report.csv", "rb") as f:
httpx.post(f"https://api.telegram.org/bot{BOT_TOKEN}/sendDocument",
data={"chat_id": CHAT_ID}, files={"document": f})
Why Not Slack/Discord/Email?
| Feature | Telegram | Slack | |
|---|---|---|---|
| Setup time | 2 min | 15 min | 30 min |
| Cost | Free | Free (limited) | Free (limited) |
| Mobile push | Instant | Instant | Varies |
| No account needed for bot | Yes | No | No |
| Rate limit | 30 msg/sec | 1 msg/sec | Varies |
| Rich formatting | HTML/Markdown | Markdown | HTML |
Telegram wins on simplicity. For production systems with teams, use Slack. For personal tools and side projects, Telegram is unbeatable.
📧 spinov001@gmail.com — I build automated data pipelines with monitoring. Need a custom solution?
Related: How I Run 77 Scrapers on a Schedule | 10 Dev Tools I Use Daily | 150+ Free APIs
Also: Neon Free Postgres | Vercel Free API | Hetzner 4x More Server
Top comments (0)