notifi

1.0.2 • Public • Published

notifi

simple little module that sends a JSON payload to an arbitary endpoint or more specifically, the slack/hipchat notification APIs. The main purpose of this is to be a singular dispatcher with an expected format that works seamlessly with all of these services. Options will be smartly intuited in the constructor.

Example

//
// Example with slack
//
var notify = require('notifi');
 
var options = {
  token: 'p19845osdfgsd0998',
  domain: 'myCompany'
};
 
var note = notify(options);
 
var payload = {
  channel: '#general',
  text: 'Here is my message!',
  username: 'notifier'
};
 
note.on('error', function (err) {
  console.error(err);
});
 
note.on('done', function () {
  console.log('finished');
});
 
note.dispatch(payload);
 

This shows the event emitter interface, you can also pass the dispatch a callback as the second argument and handle the error/response that way.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i notifi

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jcrugzz