Gathering detailed insights and metrics for node-notifier
Gathering detailed insights and metrics for node-notifier
Gathering detailed insights and metrics for node-notifier
Gathering detailed insights and metrics for node-notifier
@types/node-notifier
TypeScript definitions for node-notifier
webpack-notifier
webpack + node-notifier = build status system notifications
webpack-build-notifier
A Webpack plugin that generates OS notifications for build steps using node-notifier.
node-notifier-cli
CLI API for node-notifier
A Node.js module for sending notifications on native Mac, Windows and Linux (or Growl as fallback)
npm install node-notifier
Typescript
Module System
Node Version
NPM Version
JavaScript (99.9%)
Shell (0.1%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5,787 Stars
625 Commits
318 Forks
63 Watchers
6 Branches
60 Contributors
Updated on Jul 13, 2025
Latest Version
10.0.1
Package Id
node-notifier@10.0.1
Unpacked Size
5.41 MB
Size
1.88 MB
File Count
27
NPM Version
8.1.2
Node Version
16.13.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Send cross platform native notifications using Node.js. Notification Center for macOS,
notify-osd
/libnotify-bin
for Linux, Toasters for Windows 8/10, or taskbar balloons for
earlier Windows versions. Growl is used if none of these requirements are met.
Works well with Electron.
Show a native notification on macOS, Windows, Linux:
1const notifier = require('node-notifier'); 2// String 3notifier.notify('Message'); 4 5// Object 6notifier.notify({ 7 title: 'My notification', 8 message: 'Hello, there!' 9});
notify-osd
or libnotify-bin
installed (Ubuntu should have this by default)See documentation and flow chart for reporter choice.
1npm install --save node-notifier
CLI has moved to separate project: https://github.com/mikaelbr/node-notifier-cli
Standard usage, with cross-platform fallbacks as defined in the reporter flow chart. All of the options below will work in some way or another on most platforms.
1const notifier = require('node-notifier'); 2const path = require('path'); 3 4notifier.notify( 5 { 6 title: 'My awesome title', 7 message: 'Hello from node, Mr. User!', 8 icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons) 9 sound: true, // Only Notification Center or Windows Toasters 10 wait: true // Wait with callback, until user action is taken against notification, does not apply to Windows Toasters as they always wait or notify-send as it does not support the wait option 11 }, 12 function (err, response, metadata) { 13 // Response is response from notification 14 // Metadata contains activationType, activationAt, deliveredAt 15 } 16); 17 18notifier.on('click', function (notifierObject, options, event) { 19 // Triggers if `wait: true` and user clicks notification 20}); 21 22notifier.on('timeout', function (notifierObject, options) { 23 // Triggers if `wait: true` and notification closes 24});
If you want super fine-grained control, you can customize each reporter individually, allowing you to tune specific options for different systems.
See below for documentation on each reporter.
Example:
1const NotificationCenter = require('node-notifier/notifiers/notificationcenter'); 2new NotificationCenter(options).notify(); 3 4const NotifySend = require('node-notifier/notifiers/notifysend'); 5new NotifySend(options).notify(); 6 7const WindowsToaster = require('node-notifier/notifiers/toaster'); 8new WindowsToaster(options).notify(); 9 10const Growl = require('node-notifier/notifiers/growl'); 11new Growl(options).notify(); 12 13const WindowsBalloon = require('node-notifier/notifiers/balloon'); 14new WindowsBalloon(options).notify();
Or, if you are using several reporters (or you're lazy):
1// NOTE: Technically, this takes longer to require 2const nn = require('node-notifier'); 3 4new nn.NotificationCenter(options).notify(); 5new nn.NotifySend(options).notify(); 6new nn.WindowsToaster(options).notify(options); 7new nn.WindowsBalloon(options).notify(options); 8new nn.Growl(options).notify(options);
NotificationCenter
Same usage and parameter setup as terminal-notifier
.
Native Notification Center requires macOS version 10.8 or higher. If you have an earlier version, Growl will be the fallback. If Growl isn't installed, an error will be returned in the callback.
Because node-notifier
wraps around terminal-notifier
,
you can do anything terminal-notifier
can, just by passing properties to the notify
method.
For example:
terminal-notifier
says -message
, you can do {message: 'Foo'}
terminal-notifier
says -list ALL
, you can do {list: 'ALL'}
.Notification is the primary focus of this module, so listing and activating do work, but they aren't documented.
1const NotificationCenter = require('node-notifier').NotificationCenter; 2 3var notifier = new NotificationCenter({ 4 withFallback: false, // Use Growl Fallback if <= 10.8 5 customPath: undefined // Relative/Absolute path to binary if you want to use your own fork of terminal-notifier 6}); 7 8notifier.notify( 9 { 10 title: undefined, 11 subtitle: undefined, 12 message: undefined, 13 sound: false, // Case Sensitive string for location of sound file, or use one of macOS' native sounds (see below) 14 icon: 'Terminal Icon', // Absolute Path to Triggering Icon 15 contentImage: undefined, // Absolute Path to Attached Image (Content Image) 16 open: undefined, // URL to open on Click 17 wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds 18 19 // New in latest version. See `example/macInput.js` for usage 20 timeout: 5, // Takes precedence over wait if both are defined. 21 closeLabel: undefined, // String. Label for cancel button 22 actions: undefined, // String | Array<String>. Action label or list of labels in case of dropdown 23 dropdownLabel: undefined, // String. Label to be used if multiple actions 24 reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter. 25 }, 26 function (error, response, metadata) { 27 console.log(response, metadata); 28 } 29);
Note: The wait
option is shorthand for timeout: 5
. This just sets a timeout
for 5 seconds. It does not make the notification sticky!
As of Version 6.0 there is a default timeout
set of 10
to ensure that the application closes properly. In order to remove the timeout
and have an instantly closing notification (does not support actions), set timeout
to false
. If you are using action
it is recommended to set timeout
to a high value to ensure the user has time to respond.
Exception: If reply
is defined, it's recommended to set timeout
to a either
high value, or to nothing at all.
For macOS notifications: icon
, contentImage
, and all forms of reply
/actions
require macOS 10.9.
Sound can be one of these: Basso
, Blow
, Bottle
, Frog
, Funk
, Glass
,
Hero
, Morse
, Ping
, Pop
, Purr
, Sosumi
, Submarine
, Tink
.
If sound
is simply true
, Bottle
is used.
See Also:
Custom Path clarification
customPath
takes a value of a relative or absolute path to the binary of your
fork/custom version of terminal-notifier
.
Example: ./vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier
Spotlight clarification
terminal-notifier.app
resides in a mac.noindex
folder to prevent Spotlight from indexing the app.
WindowsToaster
Note: There are some limitations for images in native Windows 8 notifications:
These limitations are due to the Toast notification system. A good tip is to use
something like path.join
or path.delimiter
to keep your paths cross-platform.
From mikaelbr/gulp-notify#90 (comment)
You can make it work by going to System > Notifications & Actions. The 'toast' app needs to have Banners enabled. (You can activate banners by clicking on the 'toast' app and setting the 'Show notification banners' to On)
Windows 10 Fall Creators Update (Version 1709) Note:
Snoretoast is used to get native Windows Toasts!
The default behaviour is to have the underlying toaster applicaton as appID
.
This works as expected, but shows SnoreToast
as text in the notification.
With the Fall Creators Update, Notifications on Windows 10 will only work as
expected if a valid appID
is specified. Your appID
must be exactly the same
value that was registered during the installation of your app.
You can find the ID of your App by searching the registry for the appID
you
specified at installation of your app. For example: If you use the squirrel
framework, your appID
will be something like com.squirrel.your.app
.
1const WindowsToaster = require('node-notifier').WindowsToaster; 2 3var notifier = new WindowsToaster({ 4 withFallback: false, // Fallback to Growl or Balloons? 5 customPath: undefined // Relative/Absolute path if you want to use your fork of SnoreToast.exe 6}); 7 8notifier.notify( 9 { 10 title: undefined, // String. Required 11 message: undefined, // String. Required if remove is not defined 12 icon: undefined, // String. Absolute path to Icon 13 sound: false, // Bool | String (as defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx) 14 id: undefined, // Number. ID to use for closing notification. 15 appID: undefined, // String. App.ID and app Name. Defaults to no value, causing SnoreToast text to be visible. 16 remove: undefined, // Number. Refer to previously created notification to close. 17 install: undefined // String (path, application, app id). Creates a shortcut <path> in the start menu which point to the executable <application>, appID used for the notifications. 18 }, 19 function (error, response) { 20 console.log(response); 21 } 22);
Growl
1const Growl = require('node-notifier').Growl; 2 3var notifier = new Growl({ 4 name: 'Growl Name Used', // Defaults as 'Node' 5 host: 'localhost', 6 port: 23053 7}); 8 9notifier.notify({ 10 title: 'Foo', 11 message: 'Hello World', 12 icon: fs.readFileSync(__dirname + '/coulson.jpg'), 13 wait: false, // Wait for User Action against Notification 14 15 // and other growl options like sticky etc. 16 sticky: false, 17 label: undefined, 18 priority: undefined 19});
See more information about using growly.
WindowsBalloon
For earlier versions of Windows, taskbar balloons are used (unless
fallback is activated and Growl is running). The balloons notifier uses a great
project called notifu
.
1const WindowsBalloon = require('node-notifier').WindowsBalloon; 2 3var notifier = new WindowsBalloon({ 4 withFallback: false, // Try Windows Toast and Growl first? 5 customPath: undefined // Relative/Absolute path if you want to use your fork of notifu 6}); 7 8notifier.notify( 9 { 10 title: undefined, 11 message: undefined, 12 sound: false, // true | false. 13 time: 5000, // How long to show balloon in ms 14 wait: false, // Wait for User Action against Notification 15 type: 'info' // The notification type : info | warn | error 16 }, 17 function (error, response) { 18 console.log(response); 19 } 20);
See full usage on the project homepage: notifu
.
NotifySend
Note: notify-send
doesn't support the wait
flag.
1const NotifySend = require('node-notifier').NotifySend; 2 3var notifier = new NotifySend(); 4 5notifier.notify({ 6 title: 'Foo', 7 message: 'Hello World', 8 icon: __dirname + '/coulson.jpg', 9 10 wait: false, // Defaults no expire time set. If true expire time of 5 seconds is used 11 timeout: 10, // Alias for expire-time, time etc. Time before notify-send expires. Defaults to 10 seconds. 12 13 // .. and other notify-send flags: 14 'app-name': 'node-notifier', 15 urgency: undefined, 16 category: undefined, 17 hint: undefined 18});
See flags and options on the man page notify-send(1)
node-notifier
is made possible through Open Source Software.
A very special thanks to all the modules node-notifier
uses.
SnoreToast
textSee note on "Windows 10 Fall Creators Update" in Windows section.
Short answer: update your appID
.
If you don't see notifications within WSL2, you might have to change permission of exe vendor files (snoreToast). See issue for more info
When using node-notifier
within a tmux session, it can cause a hang in the system.
This can be solved by following the steps described in this comment
There’s even more info here https://github.com/mikaelbr/node-notifier/issues/61#issuecomment-163560801.
Even if you define an icon in the configuration object for node-notifier
, you will
see a small Terminal icon in the notification (see the example at the top of this
document).
This is the way notifications on macOS work. They always show the icon of the
parent application initiating the notification. For node-notifier
, terminal-notifier
is the initiator, and it has the Terminal icon defined as its icon.
To define your custom icon, you need to fork terminal-notifier
and build your
custom version with your icon.
See Issue #71 for more info https://github.com/mikaelbr/node-notifier/issues/71.
If packaging your Electron app as an asar
, you will find node-notifier
will fail to load.
Due to the way asar works, you cannot execute a binary from within an asar
.
As a simple solution, when packaging the app into an asar please make sure you
--unpack
the vendor/
folder of node-notifier
, so the module still has access to
the notification binaries.
You can do so with the following command:
1asar pack . app.asar --unpack "./node_modules/node-notifier/vendor/**"
Or if you use electron-builder
without using asar directly, append build
object to your package.json
as below:
1... 2build: { 3 asarUnpack: [ 4 './node_modules/node-notifier/**/*', 5 ] 6}, 7...
For issues using with the pkg module. Check this issue out: https://github.com/mikaelbr/node-notifier/issues/220#issuecomment-425963752
When using node-notifier
inside of webpack
, you must add the snippet below to your webpack.config.js
.
This is necessary because node-notifier
loads the notifiers from a binary, so it
needs a relative file path. When webpack compiles the modules, it suppresses file
directories, causing node-notifier
to error on certain platforms.
To fix this, you can configure webpack to keep the relative file directories.
Do so by append the following code to your webpack.config.js
:
1node: { 2 __filename: true, 3 __dirname: true 4}
This package is licensed using the MIT License.
SnoreToast and Notifu have licenses in their vendored versions which do not match the MIT license, LGPL-3 and BSD 3-Clause to be specific. We are not lawyers, but have made our best efforts to conform to the terms in those licenses while releasing this package using the license we chose.
5.6/10
Summary
OS Command Injection in node-notifier
Affected Versions
< 8.0.1
Patched Versions
8.0.1
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 3/8 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More