Skip to content

Instantly share code, notes, and snippets.

@MihailPreis
Last active October 14, 2022 21:48
Show Gist options
  • Save MihailPreis/701670ba95e015a37342bdde88cb7ed3 to your computer and use it in GitHub Desktop.
Save MihailPreis/701670ba95e015a37342bdde88cb7ed3 to your computer and use it in GitHub Desktop.
Telegram alert sh
#!/bin/bash
# Example: echo "Hello" | tg_alert.sh
# For find out the chat ID, use https://api.telegram.org/bot<token>/getUpdates
#
message=$1
apiToken="<TG_BOT_API_KEY>"
chatId="<TG_CHAT_ID>"
if [[ ! -z "$message" ]]; then
curl -s \
-X POST \
https://api.telegram.org/bot$apiToken/sendMessage \
-d text="$message" \
-d chat_id=$chatId
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment