All Projects → felixrieseberg → electron-windows-interactive-notifications

felixrieseberg / electron-windows-interactive-notifications

Licence: MIT License
⚡ Respond to interactive notifications on Windows, from Electron

Programming Languages

C++
36643 projects - #6 most used programming language
javascript
184084 projects - #8 most used programming language
C#
18002 projects
python
139335 projects - #7 most used programming language
objective c
16641 projects - #2 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to electron-windows-interactive-notifications

VanillaToasts
Agnostic Javascript Library for Website Notifications
Stars: ✭ 89 (+64.81%)
Mutual labels:  notifications
telegram-notification
Azure DevOps Extension to send custom notifications to Telegram
Stars: ✭ 17 (-68.52%)
Mutual labels:  notifications
SpaceView
No description or website provided.
Stars: ✭ 58 (+7.41%)
Mutual labels:  notifications
chia-monitor
🍃 A comprehensive monitoring and alerting solution for the status of your Chia farmer and harvesters.
Stars: ✭ 131 (+142.59%)
Mutual labels:  notifications
pusherman
queuing system for push notifications
Stars: ✭ 17 (-68.52%)
Mutual labels:  notifications
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (+18.52%)
Mutual labels:  notifications
Utlyz-CLI
Let's you to access your FB account from the command line and returns various things number of unread notifications, messages or friend requests you have.
Stars: ✭ 30 (-44.44%)
Mutual labels:  notifications
Xetaravel-Mentions
A package to parse @mentions from a text and mention the users with Laravel.
Stars: ✭ 26 (-51.85%)
Mutual labels:  notifications
gnome-email-notifications
Gnome Email Notifications
Stars: ✭ 65 (+20.37%)
Mutual labels:  notifications
Pushover.NET
📣 .NET Wrapper for the Pushover API
Stars: ✭ 27 (-50%)
Mutual labels:  notifications
gitlab-ci-discord-webhook
⛓ Here's your serverless solution for sending build status from GitLab CI to Discord as webhooks.
Stars: ✭ 32 (-40.74%)
Mutual labels:  notifications
react-notify
Tiny React's module that shows notifications.
Stars: ✭ 55 (+1.85%)
Mutual labels:  notifications
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (+81.48%)
Mutual labels:  notifications
github-vacations
Automagically ignore all notifications related to work when you are on vacations
Stars: ✭ 20 (-62.96%)
Mutual labels:  notifications
checkmk-telegram-notify
Get alerted by Check_MK via Telegram bash script
Stars: ✭ 28 (-48.15%)
Mutual labels:  notifications
node-backend-template
A template for NodeJS backend projects
Stars: ✭ 19 (-64.81%)
Mutual labels:  notifications
notifyme
react-notification-timeline is a react based component helps in managing the notification in time-based manner.
Stars: ✭ 94 (+74.07%)
Mutual labels:  notifications
wallpaperboard-enhanced
Android Json based wallpaper dashboard library
Stars: ✭ 39 (-27.78%)
Mutual labels:  notifications
keeptune
Google Chrome Extension to download on Bandcamp, Soundcloud...
Stars: ✭ 49 (-9.26%)
Mutual labels:  notifications
Quizzine
Firebase Authentication,Realtime database,Firebase push notification,Firebase Quiz.The whole app contains dynamic data using firebase.
Stars: ✭ 37 (-31.48%)
Mutual labels:  notifications

Respond to Interactive Notifications, from Node or Electron

This project allows you to respond to Windows interactive notifications. Interactive notifications allow the user to interact with the notification by entering data. In order to receive that data, your application will need to register a COM component with the operating system.

📝 To send notifications from Electron, take a look at electron-windows-notifications

Installation

⚠️ Please read these instructions carefully.

A unique identifier for all apps

When a win32 desktop application sends an interactive toast notification, Windows checks if the start menu contains a shortcut to the sending binary. If that is the case, it will check the shortcut for the System.AppUserModel.ToastActivatorCLSID property. If that property is set, it will attempt to activate a COM component using the given CLSID. The CLSID needs to be defined at compile-time and needs to be unique. This property is in concept similar to the AppUserModelId.

For that reason, this module will either use a specified CLSID or generate a random CLSID during installation and print it to console. There are two ways to set the CLSID:

  • Using an environment variable TOAST_ACTIVATOR_CLSID
  • Using the package.json of your application
{
    "dependencies": { },
    "interactive-notifications": {
        "toast-activator-clsid": "B23D2B18-8DD7-403A-B9B7-152B40A1478C"
    }
}

For that reason, this module compiles either using a set environment variable, a property "windows-notifications": { "toastActivatorCLSID": "YOUR_ID" }, or will generate a unique CLSID during installation. In both cases it will print to the console which CLSID was used.

The protocol to launch

To start your application, this module uses protocol links (like spotify:// or slack://). Define the protocol that will be compiled into the dll using one of the following two methods:

  • Using an environment variable TOAST_ACTIVATOR_PROTOCOL
  • Using the package.json of your application
{
    "dependencies": { },
    "interactive-notifications": {
        "protocol": "myapp://"
    }
}

Example Installation

$env:TOAST_ACTIVATOR_PROTOCOL="myapp://"
$env:TOAST_ACTIVATOR_CLSID="B23D2B18-8DD7-403A-B9B7-152B40A1478C"
npm install --save windows-interactive-notifications

Usage

This module contains only three methods relevant to you:

registerAppForNotificationSupport(shortcutPath, appId)

In order to receive interactive notification activations, your application must have a shortcut in the Start Menu. That shortcut needs to contain two values in its propertyStore: A System.AppUserModel.ToastActivatorCLSID and a System.AppUserModel.Id. You don't have to use this module to set the shortcut, but it is offered for your convenience. Since the CLSID needs to be hardcoded at compile-time, it is not a parameter (see installation for more details).

Example

const {registerAppForNotificationSupport} = require('windows-interactive-notifications')
const shortcutPath = 'Microsoft\\Windows\\Start Menu\\MyApp.lnk'
const appId = 'com.squirrel.mycompany.myapp'

registerAppForNotificationSupport(shortcutPath, appId)

registerComServer()

Before registering the activator, make sure to register the COM Server. Automatically called by registerAppForNotificationSupport(), you only have to call this method if you used Squirrel or a different program to manage your shortcut.

registerActivator()

Use this method to enable the activator. It registers the COM component with Windows. Call it before sending a notification. Calling it multiple times has no downside.

unregisterActivator()

Use this method to disable the activator. It unregisters the COM component with Windows.

Example Usage

Once you have registered your application for notification support (either using your own shortcut creation method or the one given in this module), register the activator.

This module will communicate with your application using protocol links. You might know about mailto: - and how you can tell an email application to create a new email draft by calling mailto:[email protected]?subject=This%20is%20the%20subject. Well, this module works the same way: During installation, you defined your applications protocol. It is up to you to ensure that your app can actually receive those links. To debug this behavior, feel free to just use Windows Run (open it with Windows + R).

The app will activate your app in the following format:

<Protocol><Toast Arguments>&userData=[{"key":"value"}]

So, for a notification that contains the following template, your app would be called with the following URI:

<actions>
  <input id="message" type="text" placeHolderContent="Type a reply" />
  <action hint-inputId="message" activationType="background" content="Reply" arguments="message/?user=123" />
</actions>
myapp://message/?user=123&userData=[{"key":"message","value":"Hello"}]

This module does super-basic escaping. Spaces are turned into %20, doublequotes (") are turned into %22. Ironically though, Unicode is supported.

License

MIT. Please see License for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].