Created
February 4, 2019 16:13
-
-
Save LB-Digital/6c5e0443efeb824a3983e9199b46d59d to your computer and use it in GitHub Desktop.
A function for sending Pushover Notifications ( https://pushover.net/ )
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
function sendPushoverNotif(token, target, message, title){ | |
message = encodeURIComponent(message); // make url friendly | |
var xhr = new XMLHttpRequest(); | |
xhr.open("POST", "https://api.pushover.net/1/messages.json", true); | |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
xhr.send(`token=${token}&user=${target}&message=${message}&title=${title}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment