# pushover-notifications

> Pushover API for node.js

Latest version **1.2.3** (published 2024-05-29) · 0 weekly downloads

## Install

```sh
npm install pushover-notifications
pnpm add pushover-notifications
yarn add pushover-notifications
bun add pushover-notifications
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2024-05-29 |
| First published | 2012-03-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Unpacked size | 25.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aaron Bieber |
| Maintainers | qbit |

## Links

- npm: https://www.npmjs.com/package/pushover-notifications
- Repository: https://github.com/qbit/node-pushover
- Homepage: http://github.com/qbit/node-pushover
- Issues: https://github.com/qbit/node-pushover/issues
- npm.io page: https://npm.io/package/pushover-notifications

## Recent versions

- 1.2.3 (latest) — 2024-05-29
- 1.2.2 — 2020-01-30
- 1.2.1 — 2019-10-27
- 1.2.0 — 2018-10-22
- 1.0.0 — 2018-01-15
- 0.2.4 — 2016-12-02
- 0.2.3 — 2016-06-06
- 0.2.2 — 2014-12-07
- 0.2.1 — 2014-10-11
- 0.2.0 — 2014-06-30
- 0.1.9 — 2014-05-06
- 0.1.8 — 2014-03-03
- 0.1.7 — 2014-03-03
- 0.1.6 — 2013-11-30
- 0.1.5 — 2013-05-08
- … 5 more at https://npm.io/package/pushover-notifications/versions

## README

![Pushover](img/pushover-header.png)

Send [pushover.net](http://pushover.net) notifications from Node.JS

[![Build Status](https://travis-ci.org/qbit/node-pushover.svg?branch=master)](https://travis-ci.org/qbit/node-pushover)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/10939/badge.svg)](https://scan.coverity.com/projects/qbit-node-pushover)


[![NPM](https://nodei.co/npm/pushover-notifications.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/pushover-notifications/)

## Usage

### Install

	npm install pushover-notifications

### Pushover API values

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.
```javascript
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"
}
```
## Examples

### Sending a message
```javascript

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 )
})
```

### Sending a message with an attachment (blocking)
```javascript

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 )
})
```

### Sending a message with an attachment (non-blocking)
```javascript

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 )
  })
})
```

### Sending a message to multiple users

```javascript

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 )
  })
}
```

---
_Source: https://npm.io/package/pushover-notifications · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
