Pushover
Pushover is a simple push notification service that integrates easily into web apps like IFTTT, network monitoring systems, security cameras, shell scripts, and anything else that needs to send alerts to your iPhone, iPad, and other robot-like mobile devices.[1]
- Project Homepage [EN]
- Pushover [EN] @ Apple App Store
Documentation
- API [EN]
- Knowledge Base [EN]
Examples
- Generate a push notification using Bash
Define a function nf::pushover:
nf::pushover() {
if [[ "$#" -ne 2 ]]; then
my::carp 'Error calling function!'
return 1
fi
for var in PUSHOVER_{APP_TOKEN,USER_KEY}; do
if [[ -z "${!var}" || "${!var}" =~ ^[a-zA-Z0-9]$ ]]; then
my::carp "Error finding Pushover related var: ${var}!"
return 1
fi
done
if ! curl --fail --silent --ssl-reqd \
--form-string "token=${PUSHOVER_APP_TOKEN}" \
--form-string "user=${PUSHOVER_USER_KEY}" \
--form-string "title=$1" \
--form-string "message=$(cut --characters="1-$((250 - ${#1}))" <<<"$2")" \
--form-string "priority=0" \
--form-string "timestamp=$(date '+%s')" \
'https://api.pushover.net/1/messages.json'
then
my::carp 'Error sending Pushover message!'
return 1
fi
}
Define the environment:
PUSHOVER_APP_TOKEN='**********'
PUSHOVER_USER_KEY='**********'
Call the function with two arguments (title and message):
nf::pushover 'Test Pushover' 'This is a Pushover test!'