Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I send a notification in electron?

Using electron / node.js for desktop application. Trying to figure out how to produce a notification on the desktop. Is it built into the electron API?

like image 958
James Slattery Avatar asked Mar 17 '17 07:03

James Slattery


People also ask

What is electron notification?

Electron provides the built-in Notification Module which allows the application to send Custom Notifications, using the operating systems native notification APIs to display it. This tutorial will demonstrate how to create Custom Desktop Notifications using the Notification Module.

How do I add an app to notifications in Windows 10?

Go to Settings > System > Notifications & actions‌ , under Get notifications from these senders select the app, and then under Priority of notifications in action center select Top.


1 Answers

node-notifier made easier to send native notifications. Node notifier A Node.js module for sending notifications on native Mac, Windows, and Linux (or Growl as fallback).

Github

Install:

npm install --save node-notifier

Example:

const notifier = require('node-notifier');
// String
notifier.notify('Message');

// Object
notifier.notify({
  title: 'My notification',
  message: 'Hello, there!'
});

Notification:

enter image description here

like image 195
Ilyas karim Avatar answered Sep 30 '22 01:09

Ilyas karim