node package manager

node-pushover

node.js pushover module for https://pushover.net/api

node-pushover

node.js pushover module for https://pushover.net/api

You can install node-pushover using the Node Package Manager (npm):

npm install node-pushover

Initializes a Pushover object with the APPTOKEN and optionally a USERKEY . The USERKEY can also be given when sending the messages.

Arguments

  • USERKEY: (optional) The USERKEY as given to you by the Pushover API.
  • title: The title for your message
  • message: The content for your message
  • callback(err, res): (optional) A callback function which is called when the message is send.

Example with the USERKEY given at initialisation

var Pushover = require('node-pushover');
var push = new Pushover({
token: "APPTOKEN",
user: "USERKEY"
});
 
// No callback function defined: 
push.send("Some title", "Node.js is Cool!! - no callback");
 
// A callback function is defined: 
push.send("Some title", "Node.js is Cool!!", function (errres){
if(err){
console.log("We have an error:");
console.log(err);
console.log(err.stack);
}else{
console.log("Message send successfully");
console.log(res);
}
});

Example with the USERKEY given when the message is send

var Pushover = require('node-pushover');
var push = new Pushover({
token: "APPTOKEN"
});
 
// No callback function defined: 
push.send("USERKEY", "Some title", "Node.js is Cool!! - no callback");
 
// A callback function is defined: 
push.send("USERKEY", "Some title", "Node.js is Cool!!", function (errres){
if(err){
console.log("We have an error:");
console.log(err);
console.log(err.stack);
}else{
console.log("Message send successfully");
console.log(res);
}
});