Skip to content

Instantly share code, notes, and snippets.

@outadoc
Last active Jun 18, 2022
Embed
What would you like to do?
Pushover Bash Script
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: ./pushover <message> [title]"
exit
fi
MESSAGE=$1
TITLE=$2
if [ $# -lt 2 ]; then
TITLE="`whoami`@${HOSTNAME}"
fi
APP_TOKEN="YOUR_TOKEN_HERE"
USER_TOKEN="YOUR_USER_ID_HERE"
wget https://api.pushover.net/1/messages.json --post-data="token=$APP_TOKEN&user=$USER_TOKEN&message=$MESSAGE&title=$TITLE" -qO- > /dev/null 2>&1 &

Pushover bash script

This is a bash script that will allow you to send a Pushover message very easily from a script or terminal.

Usage

Just put the script somewhere, and call it this way:

> ./pushover <message> [title]

So, for example:

> ./pushover "This is a test message from my Raspberry Pi."
> ./pushover "This is another message." "Wow, dude, nice title"
@akhiljalagam
Copy link

akhiljalagam commented Nov 1, 2019

@thanks

To use directly as a function

pushmail() {
    APP_TOKEN='token'
    USER_TOKEN='token'
    TITLE="$1"
    MESSAGE="$2"
    curl 'https://api.pushover.net/1/messages.json' -X POST -d "token=$APP_TOKEN&user=$USER_TOKEN&message=\"$MESSAGE\"&title=\"$TITLE\""
}

usage

pushmail nagios "x server is down"

@lyrl
Copy link

lyrl commented Feb 21, 2021

curl -s \
                      --form-string "token=apptoken" \
                      --form-string "user=usertoken" \
                      --form-string "message=😀" \
                      --form-string "title=title" \
                      https://api.pushover.net/1/messages.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment