Telegram Notify Skill
Send messages, alerts, files, and formatted reports to any Telegram chat using your bot.
Setup
- Message @BotFather →
/newbot→ copy the token - Add the bot to your target group/channel and make it an admin
- Get the chat ID: send a message, then
curl https://api.telegram.org/bot$TOKEN/getUpdates | jq '.result[0].message.chat.id'
export TELEGRAM_BOT_TOKEN="7123456789:AAFxxx..."
export TELEGRAM_CHAT_ID="-1001234567890"
Send a Text Alert
curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-d chat_id="$TELEGRAM_CHAT_ID" \
-d text="🚨 Server CPU > 90% on prod-1" \
-d parse_mode="HTML" | jq -r '.ok'
Send Formatted HTML Message
curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-d chat_id="$TELEGRAM_CHAT_ID" \
-d parse_mode="HTML" \
-d text="<b>Daily Report</b>
Orders: <code>142</code>
Revenue: <code>RM 4,210</code>
Status: ✅ All systems normal" | jq -r '.ok'
Send a File
curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument" \
-F chat_id="$TELEGRAM_CHAT_ID" \
-F document=@"/path/to/report.pdf" \
-F caption="Weekly sales report" | jq -r '.ok'
Pin a Message
MSG_ID=$(curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-d chat_id="$TELEGRAM_CHAT_ID" \
-d text="⚠️ Maintenance window tonight 2-4AM" | jq -r '.result.message_id')
curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/pinChatMessage" \
-d chat_id="$TELEGRAM_CHAT_ID" \
-d message_id="$MSG_ID" | jq -r '.ok'
Tips
- HTML tags allowed:
<b>,<i>,<code>,<pre>,<a href="...">— escape<>&in content - Max message length: 4096 characters; split long messages
- For channels: use
@channelusernameor numeric ID starting with-100 - Silence notifications: add
-d disable_notification=true