Skip to content

Instantly share code, notes, and snippets.

@ddepaoli3
Last active December 10, 2019 12:55
Show Gist options
  • Save ddepaoli3/495bb416217c97f9c1da1e5c7d84752a to your computer and use it in GitHub Desktop.
Save ddepaoli3/495bb416217c97f9c1da1e5c7d84752a to your computer and use it in GitHub Desktop.
Send message to telegram with curl
#!/bin/bash
#HOW TO USE SCRIPT:
# curl https://gist.githubusercontent.com/ddepaoli3/495bb416217c97f9c1da1e5c7d84752a/raw/549b7aaad6529379297f62682f10887a725bde41/send_message_to_telegram.sh | bash /dev/stdin '<message>' '<chat_id>' '<chat_token>'
#
MESSAGE=$1
CHAT_ID=$2
TOKEN=$3
if [[ $# -ne 3 ]]
then
echo "Errore"
exit -1
fi
curl -s -X POST https://api.telegram.org/bot$TOKEN/sendMessage -d chat_id=$CHAT_ID -d text="$MESSAGE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment