Tactical
Telegram trade alerts from Python
If the bot trades while you sleep, you still need a tap on the shoulder. Telegram is the usual channel: cheap, instant, and easy to call from a few lines of Python.
Why Telegram instead of email
Email is slow and filters eat “bot bought BTC” messages. Telegram delivers in a second and you can mute the chat overnight except for errors.
Create the bot
- In Telegram, open @BotFather.
- Send /newbot and follow the prompts.
- Save the token. Treat it like a password.
- Start a chat with your new bot and send /start.
Get your chat ID
Send a message to the bot, then call getUpdates once from the server (not from a public notebook).
curl "https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates"
Look for "chat":{"id": 123456789}. That number is the destination.
TELEGRAM_BOT_TOKEN= TELEGRAM_CHAT_ID=
Minimal send function
import os, requests
def alert(text: str) -> None:
token = os.environ["TELEGRAM_BOT_TOKEN"]
chat = os.environ["TELEGRAM_CHAT_ID"]
url = f"https://api.telegram.org/bot{token}/sendMessage"
r = requests.post(url, json={"chat_id": chat, "text": text[:3900]}, timeout=15)
r.raise_for_status()
What is worth an alert
Send
- Process started / stopped
- Order submitted, filled, canceled
- Stop-loss placed or hit
- Daily loss limit tripped
- Repeated API errors
Do not spam
- Every 5-minute “scan complete”
- Raw candles
- Full order-book dumps
- Secrets or key prefixes
A good first message after deploy is simply: openclaw up on vps-1. If that does not arrive, fix networking before you enable live orders.
Get the full walkthrough
The paid guide includes the source, config template, and deploy script. 50% off: $19.99 (was $39.99). One-time.
Get the ebook — $19.99Educational product. Trading can lose money. Not financial advice.