{"id":13820508,"url":"https://github.com/felixrieseberg/electron-windows-interactive-notifications","last_synced_at":"2025-07-24T03:02:10.378Z","repository":{"id":57221995,"uuid":"71864602","full_name":"felixrieseberg/electron-windows-interactive-notifications","owner":"felixrieseberg","description":":zap: Respond to interactive notifications on Windows, from Electron","archived":false,"fork":false,"pushed_at":"2017-02-13T22:16:16.000Z","size":2388,"stargazers_count":57,"open_issues_count":6,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-28T01:18:12.257Z","etag":null,"topics":["electron","notifications","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felixrieseberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-25T06:02:18.000Z","updated_at":"2025-03-10T22:06:41.000Z","dependencies_parsed_at":"2022-09-04T13:11:36.569Z","dependency_job_id":null,"html_url":"https://github.com/felixrieseberg/electron-windows-interactive-notifications","commit_stats":null,"previous_names":["felixrieseberg/interactivenotifications"],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixrieseberg%2Felectron-windows-interactive-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixrieseberg%2Felectron-windows-interactive-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixrieseberg%2Felectron-windows-interactive-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixrieseberg%2Felectron-windows-interactive-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixrieseberg","download_url":"https://codeload.github.com/felixrieseberg/electron-windows-interactive-notifications/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252633706,"owners_count":21779907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","notifications","windows"],"created_at":"2024-08-04T08:01:04.613Z","updated_at":"2025-05-06T06:32:09.532Z","avatar_url":"https://github.com/felixrieseberg.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Respond to Interactive Notifications, from Node or Electron\nThis 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.\n\n\u003e :memo: To send notifications from Electron, take a look at [`electron-windows-notifications`](https://github.com/felixrieseberg/electron-windows-notifications)\n\n# Installation\n\u003e :warning: Please read these instructions carefully.\n\n### A unique identifier for all apps\nWhen 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`.\n\nFor 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:\n\n - Using an environment variable `TOAST_ACTIVATOR_CLSID`\n - Using the `package.json` of your application\n\n ```json\n {\n     \"dependencies\": { },\n     \"interactive-notifications\": {\n         \"toast-activator-clsid\": \"B23D2B18-8DD7-403A-B9B7-152B40A1478C\"\n     }\n }\n```\n\nFor 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.\n\n### The protocol to launch\nTo 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:\n\n - Using an environment variable `TOAST_ACTIVATOR_PROTOCOL`\n - Using the `package.json` of your application\n\n ```json\n {\n     \"dependencies\": { },\n     \"interactive-notifications\": {\n         \"protocol\": \"myapp://\"\n     }\n }\n ```\n\n## Example Installation\n\n```\n$env:TOAST_ACTIVATOR_PROTOCOL=\"myapp://\"\n$env:TOAST_ACTIVATOR_CLSID=\"B23D2B18-8DD7-403A-B9B7-152B40A1478C\"\nnpm install --save windows-interactive-notifications\n```\n\n# Usage\nThis module contains only three methods relevant to you:\n\n## `registerAppForNotificationSupport(shortcutPath, appId)`\nIn 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).\n\nExample\n```javascript\nconst {registerAppForNotificationSupport} = require('windows-interactive-notifications')\nconst shortcutPath = 'Microsoft\\\\Windows\\\\Start Menu\\\\MyApp.lnk'\nconst appId = 'com.squirrel.mycompany.myapp'\n\nregisterAppForNotificationSupport(shortcutPath, appId)\n```\n\n## `registerComServer()`\nBefore 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.\n\n## `registerActivator()`\nUse 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.\n\n## `unregisterActivator()`\nUse this method to disable the activator. It unregisters the COM component with Windows.\n\n## Example Usage\nOnce 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.\n\nThis 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:someone@example.com?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`).\n\nThe app will activate your app in the following format:\n\n```\n\u003cProtocol\u003e\u003cToast Arguments\u003e\u0026userData=[{\"key\":\"value\"}]\n```\n\nSo, for a notification that contains the following template, your app would be called with the following URI:\n\n```xml\n\u003cactions\u003e\n  \u003cinput id=\"message\" type=\"text\" placeHolderContent=\"Type a reply\" /\u003e\n  \u003caction hint-inputId=\"message\" activationType=\"background\" content=\"Reply\" arguments=\"message/?user=123\" /\u003e\n\u003c/actions\u003e\n```\n\n```\nmyapp://message/?user=123\u0026userData=[{\"key\":\"message\",\"value\":\"Hello\"}]\n```\n\nThis module does super-basic escaping. Spaces are turned into `%20`, doublequotes (`\"`) are turned into `%22`. Ironically though, Unicode is supported.\n\n# License\nMIT. Please see License for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixrieseberg%2Felectron-windows-interactive-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixrieseberg%2Felectron-windows-interactive-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixrieseberg%2Felectron-windows-interactive-notifications/lists"}