Coder Social home page Coder Social logo

notifier's Introduction

Notifier

Because there wasn't a simple stupid REST based notification handler already available I spent a couple hours and built this.

API

###POST://api/v1/hipchat Sends a message to the configured hipchat channel.

{
  event: 'name',
  data: {
    ...config...
  }
}

###POST://api/v1/notification Sends a message to all available channels. Currently just HipChat.

{
  event: 'name',
  data: {
    ...config...
  }
}

Planned API

{
  event: 'name',
  data: {
    ...config...
  }
}

###POST://api/v1/email

Sample Configuration

This belongs in a config.js (not json) file in the project root.

var config = {
  default: {
    web: {
      port: 3131
    },
    hipchat: {
      token: '<Your Token Here>',
      room: '<Your Room Here>',
      sender: 'Notifications',
      color: 'grey'
    },
    tails: [
      'better check your drawers',
      'there\'s a burr for your saddle',
      'sorry to dump salt in your kool-aid',
      'feel free to have a duck fit',
      'blame it on dingus',
      'that sticks in your throat like a hair in a biscuit',
      'gird your loins',
      'shoulda had a V8',
      'that\'s a problem only a motherboard could love',
      'did I do that',
    ],
    events: {
      default: {
          hipchat: '{{inspect this}}, {{tail}}'
        },
      message: {
          hipchat: '{{message}}, {{tail}}'
        },
      data: {
          hipchat: '{{inspect data}}, {{tail}}'
        },
      halt: {
          hipchat: {
            message: '{{config.env}} - {{error.message}}, {{tail}}',
            color: 'red'
          },
          email: {
            to: '[email protected]',
            subject: '{{config.env}} - {{error.message}}',
            body: 'App: {{config.name}}\n\
Version: {{config.version}}\n\
Host: {{config.hostname}}\n\
Environment: {{config.env}}\n\
PID: {{config.pid}}\n\
\n\
ERROR: {{error.message}}\n\
\n\n\
STACK:\n\
{{error.stack}}'
          }
        },
    }
  },
  production: {
    web: {
      port: 80
    }
  }
};

module.exports = config;

Security

Nope, doesn't have any. This isn't something you should put public. Stick it in your private network for your monitor tools to shove stuff to and let it blast the info to all the channels you see fit.

notifier's People

Watchers

Jeremy Darling avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.