Skip to content

Instantly share code, notes, and snippets.

@LB-Digital
Created February 4, 2019 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LB-Digital/6c5e0443efeb824a3983e9199b46d59d to your computer and use it in GitHub Desktop.
Save LB-Digital/6c5e0443efeb824a3983e9199b46d59d to your computer and use it in GitHub Desktop.
A function for sending Pushover Notifications ( https://pushover.net/ )
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