Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
pushover-notifications
Advanced tools
Readme
Send pushover.net notifications from Node.JS
npm install pushover-notifications
Any API parameters, as found on https://pushover.net/api, can be passed in the object. For example, retry
and expire
can be added to the object being passed to .send
! Here's an example with many different parameters.
var msg = {
message: "This is a message",
title: "Well - this is fantastic",
sound: 'magic',
device: 'test_device',
priority: 2,
url: "http://pushover.net",
url_title: "Pushover Website"
}
var Push = require( 'pushover-notifications' )
var p = new Push( {
user: process.env['PUSHOVER_USER'],
token: process.env['PUSHOVER_TOKEN'],
// httpOptions: {
// proxy: process.env['http_proxy'],
//},
// onerror: function(error) {},
// update_sounds: true // update the list of sounds every day - will
// prevent app from exiting.
})
var msg = {
// These values correspond to the parameters detailed on https://pushover.net/api
// 'message' is required. All other values are optional.
message: 'omg node test', // required
title: "Well - this is fantastic",
sound: 'magic',
device: 'devicename',
priority: 1
}
p.send( msg, function( err, result ) {
if ( err ) {
throw err
}
console.log( result )
})
var Push = require( 'pushover-notifications' )
var p = new Push( {
user: process.env['PUSHOVER_USER'],
token: process.env['PUSHOVER_TOKEN'],
// httpOptions: {
// proxy: process.env['http_proxy'],
//},
// onerror: function(error) {},
// update_sounds: true // update the list of sounds every day - will
// prevent app from exiting.
})
var msg = {
// These values correspond to the parameters detailed on https://pushover.net/api
// 'message' is required. All other values are optional.
message: 'omg node test', // required
title: "Well - this is fantastic",
sound: 'magic',
device: 'devicename',
priority: 1,
file: '/tmp/fantastic.png' // this will read using fs.readFileSync()!
}
p.send( msg, function( err, result ) {
if ( err ) {
throw err
}
console.log( result )
})
var Push = require( 'pushover-notifications' )
var fs = require( 'fs' )
fs.readFile('/tmp/fantastic.png', function(err, data) {
var p = new Push( {
user: process.env['PUSHOVER_USER'],
token: process.env['PUSHOVER_TOKEN'],
// httpOptions: {
// proxy: process.env['http_proxy'],
//},
// onerror: function(error) {},
// update_sounds: true // update the list of sounds every day - will
// prevent app from exiting.
})
var msg = {
// These values correspond to the parameters detailed on https://pushover.net/api
// 'message' is required. All other values are optional.
message: 'omg node test', // required
title: "Well - this is fantastic",
sound: 'magic',
device: 'devicename',
priority: 1,
file: { name: 'fantastic.png', data: data }
}
p.send( msg, function( err, result ) {
if ( err ) {
throw err
}
console.log( result )
})
})
var users = [
'token1',
'token2',
'token3'
]
var msg = {
message: 'omg node test',
title: "Well - this is fantastic",
sound: 'magic' // optional
priority: 1 // optional,
file: '/tmp/fancy_image.png' // optional
// see test/test_img.js for more examples of attaching images
}
for ( var i = 0, l = users.length; i < l; i++ ) {
msg.user = users[i]
// token can be overwritten as well.
p.send( msg, function( err, result ) {
if ( err ) {
throw err
}
console.log( result )
})
}
FAQs
Pushover API for node.js
The npm package pushover-notifications receives a total of 1,786 weekly downloads. As such, pushover-notifications popularity was classified as popular.
We found that pushover-notifications demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.