Skip to content

Instantly share code, notes, and snippets.

@CicoZhang
Created July 24, 2018 13:13
Show Gist options
  • Save CicoZhang/4c1017a1a2f39fd9f7860e3757c09f66 to your computer and use it in GitHub Desktop.
Save CicoZhang/4c1017a1a2f39fd9f7860e3757c09f66 to your computer and use it in GitHub Desktop.
Telegram bot as a reminder
function telegram () {
curl -s -X POST https://api.telegram.org/bot[Your_API_Key]/sendMessage -d chat_id=[Your_Chat_ID] -d text="$1"}
#!/bin/bash
message=$1
if [[ -n "$message" ]]; then
curl -s -X POST https://api.telegram.org/bot[Your_API_Key]/sendMessage -d chat_id=[Your_Chat_ID] -d text="$message"
else
curl -s -X POST https://api.telegram.org/bot[Your_API_Key]/sendMessage -d chat_id=[Your_Chat_ID] -d text="The task is finished."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment