osx-notifier

Send notifications to the OS X Notification Center using terminal-notifier.app

npm install osx-notifier
25 downloads in the last week
116 downloads in the last month

osx-notifier

Reduction of node-osx-notifier to drive from the command line or directly from another node.js script, instead of an express server.

Command line install & usage

npm install -g osx-notifier

Usage (osx-notifier --help):

osx-notifier
  --type      type of icon to show;
              one of "info", "fail", or "pass" [default: "info"]

  --title     title of the notification [default: "Terminal"]
  --subtitle  subtitle of the notification
  --message   message body of the notification [required]

  --group     replace and be replaced by any notifications of the same group

  --remove    remove any notifications previously posted with this group
              (or ALL groups)

  --list      list notifications previously posted with this group
              (or ALL groups)

  --activate  bundle identifier of an application to be activated
              if the user clicks the notification

  --open      open a url / file / custom url scheme
              if the user clicks the notification

  --execute   execute a shell command
              if the user clicks the notification

  --help      print this help message
  --verbose   print extra output
  --version   print version

API install & usage

npm install osx-notifier

Or in your package.json:

{
  "dependencies": {
    "osx-notifier": "*"
  }
}

Usage:

var notify = require('osx-notifier');

var duration = 45;
notify({
  type: 'pass',
  title: 'Taskdoer Report',
  subtitle: 'Task completed',
  message: 'Took ' + duration + ' seconds.',
  group: 'taskdoer',
});

--type

The Mac OS X Notification Center can only be accessed via signed apps, and any message sent from an application must be accompanied by the icon for that application.

Three variations on terminal-notifier are included with this app, which are accessed via the different --type options:

--type sample
info info screenshot
pass pass screenshot
fail fail screenshot

Credits

Thanks to azoff for the prebuilt apps and the screenshots, and to alloy for the great OS X application wrapper.

License

Copyright © 2013 Christopher Brown. MIT Licensed.

npm loves you