node package manager

knotifo

knotifo project status

Real-time notifications pushed to your mobile phone (and more).

You must have a free account on http://notifo.com, signup here and obtain the API_USERNAME / API_SECRET pair.

Dependencies

  • nodejs v0.4.12+
  • https native module
  • querystring native module
  • knotifo repository

Installation as submodule

$ git clone git://github.com/kilianc/node-knotifo.git

Installation with npm

$ npm install knotifo

Usage

Take a look at https://api.notifo.com/ for all the API documentation.

var Notifo = require('knotifo');
 
// http://notifo.com/service/create 
var myNotifo = new Notifo("github_examples", "cb8a07f32f78dd28e034fb5a5620f42e3237dd79");
 
// simply 
myNotifo.sendNotification({ to: 'kilianc', msg: 'Hello World!' });
 
// the user needs to confirm the subscription 
myNotifo.subscribeUser({ username: 'kilianc' });
myNotifo.sendMessage({ to: 'kilianc', msg: 'whatsup?!' });
 
// with error/success callback 
myNotifo.sendNotification({ to: 'kilianc', msg: 'Hello World!' }, function(err, data){
 
    if(err) 
        throw err;
 
    console.log(data);
});
 
// the true parameter will force the error throwing 
myNotifo.sendNotification({ to: 'kilianc', msg: 'Hello World!' }, true);
 
// list broadcasting 
myNotifo.addList('friends');
myNotifo.addUserToList('friends', 'bob');
myNotifo.addUserToList('friends', 'peter');
myNotifo.addUserToList('friends', 'mario');
myNotifo.removeUserFromList('friends', 'bob');
 
// initialize a new list with the array parameter as content 
myNotifo.addList('family', ['mySillyBuddy', 'mum', 'dog']);
myNotifo.addUserToList('family', 'dad');
myNotifo.addUserToList('family', 'syster');
 
// the true parameter will force the error throwing 
myNotifo.broadcastNotification('family', { msg: 'hey family, how you doing?' });
 
myNotifo.addList('team', ['projectManager', 'designer', 'ceo', 'programmer']);
myNotifo.broadcastNotification('team', { msg: 'new user signup!' }, function(err, data){
 
    if(err)
        throw err;
 
    console.log(data);
});
 
process.on('uncaughtException', function (err) {
    myNotifo.broadcastNotification('developers', { msg: 'wake up! ' + err });
});

License

This software is released under the MIT license cited below.

Copyright (c) 2010 Kilian Ciuffolo, me@nailik.org. All Rights Reserved.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.