This package has been deprecated

Author message:

notifymyandroid is no longer active

node-notifymyandroid

1.0.1 • Public • Published

Notify My Android from Node.js

travis npm dependencies devDependencies standardjs

Notify My Android is a push message service and app for Android phones. This module provides easy to use methods for communicating with its API, allowing you to send notifications to your (or someone else's) Android phone from node.js.

node-notifymyandroid respects the API's rate limiting and manages this automagically, so you don't have to do anything! When the rate limit is reached, an error will be emitted.

Installation

npm install node-notifymyandroid

Super Simple Examples

The Notify My Android API provides 2 endpoints; one for checking the validation of an API key and one to send a notification.

Example to check if the provided API key is valid

var Notifier = require('node-notifymyandroid').Notifier;
var notifier = new Notifier('Application Name', 'Your developer key, if you have one. This is optional.');
 
notifier.isValidKey('Your 48 bytes long NMA API key' function(err, valid) {
    if (err) return console.error(err);
    console.log('Is this key valid? %s', (valid) ? 'Yes' : 'No');
});

Example of how to send a notification

var Notifier = require('node-notifymyandroid').Notifier;
var notifier = new Notifier('Application Name', 'Your developer key, if you have one. This is optional.');
 
// All options are optional
var options = {
    priority: 2, // The priority of the notification (-2 to 2, default is 0)
    url: 'http://github.com/MichielvdVelde/node-notifymyandroid', // The URL to include
    contentType: 'text/html' // To allow basic HTML tags
}
notifier.sendNotification('API keys separated by commas. Each API key is a 48 bytes hexadecimal string.', 'The event that is being notified.', 'The notification text.', options, function (err) {
    if (err) return console.error(err);
    console.log('Message sent: %d calls remaining in the next %d minutes', notifier.getRemainingCalls(), notifier.getRemainingTime());
});

Changelog

  • V 1.0.1
    • Fixed parse XML body error callback
  • V 1.0.0
    • Rewritten code, added all currently available API options and documented functions
  • V 0.1.4
    • Fixed notifier.getRemainingCalls
  • V 0.1.3
    • Fixed notifier.hasCallsRemaining
  • V 0.1.2
    • Now supports notifier.isValidKey('another key here', function(err, valid) { }) to check the validity of a different key than when the object was created
    • Made notifier.hasCallsRemaining() available to check if the IP address still has calls remaining (returns a boolean)

License

Copyright 2017 Michiel van der Velde.

Licenced under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i node-notifymyandroid

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • michielvdvelde