Skip to content

Instantly share code, notes, and snippets.

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 stammy/440273 to your computer and use it in GitHub Desktop.
Save stammy/440273 to your computer and use it in GitHub Desktop.
Notifo JS example: Send message to user from their own user account
function sendNotifo(msg,title,uri,label) {
var https = new XMLHttpRequest();
var auth = "Basic " + Base64.encode(localStorage.notifo_username+':'+localStorage.notifo_apisecret);
var push = 'to=' + encodeURIComponent(localStorage.notifo_username) + '&msg=' + encodeURIComponent(msg) + '&uri=' + encodeURIComponent(uri) + '&label=' + encodeURIComponent(label)+ '&title=' + encodeURIComponent(title);
https.open('POST', 'https://api.notifo.com/v1/send_notification', true);
https.setRequestHeader('Authorization', auth);
https.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
https.send(push);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment