Created
July 16, 2018 01:48
-
-
Save xunzhou/d3daafcf748f199c1e60b5b3ec8f292e to your computer and use it in GitHub Desktop.
Send Message to Telegram Bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bot_key="<API Token from BotFather>" | |
# Need to send a message to your bot in order to see chat_id. | |
chat_id="<chat_id from https://api.telegram.org/bot<bot_key>/getUpdates>" | |
response=$(curl -s "https://api.telegram.org/bot$bot_key/sendMessage?chat_id=$chat_id&text=$@") | |
status=$(echo $response | cut -d ':' -f2 | cut -d ',' -f1) | |
echo "Sent: $status" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spaces in messages need to be quoted.