Skip to content

feat: add id, groupId, and groupTitle support for Windows notifications#50328

Open
bitdisaster wants to merge 6 commits intoelectron:mainfrom
bitdisaster:notification-id-for-windows
Open

feat: add id, groupId, and groupTitle support for Windows notifications#50328
bitdisaster wants to merge 6 commits intoelectron:mainfrom
bitdisaster:notification-id-for-windows

Conversation

@bitdisaster
Copy link
Contributor

Description of Change

This PR extends the Windows notification implementation to support the id, groupId, and groupTitle properties, bringing feature parity with macOS and adding Windows-specific header grouping support.

Changes

New Features:
  • id property now works on Windows — maps directly to the toast notification’s Tag property for deduplication and removal.
  • groupId property now works on Windows — it serves two purposes:
    • together with id it uniquely identifies a notification in memory
    • maps to the toast notification’s header id property for grouping in Action Center
  • groupTitle property (Windows only) — when both groupId and groupTitle are specified, a <header> element is generated in the toast XML to display a visual group header.
Validation:
  • Added length validation for id and groupId on Windows (max 64 UTF-16 characters) with descriptive error messages.
Internal Changes:
  • Removed FastHash encoding of notification IDs — the raw id is now used directly as the Windows toast Tag.
  • Added debug logging for group and tag values when ELECTRON_DEBUG_NOTIFICATIONS is set.
Tests:
  • Extended existing macOS tests to also run on Windows (id, groupId properties).
  • Added Windows-specific tests for groupTitle.
  • Added validation tests for length limits.

Example Usage

const { Notification } = require('electron')

// Basic usage with id and groupId
const n = new Notification({
  id: 'msg-123',
  groupId: 'chat-channel-1',
  title: 'New Message',
  body: 'Hello!'
})

// With header grouping (Windows only)
const n2 = new Notification({
  id: 'msg-456',
  groupId: 'camping-trip',
  groupTitle: 'Camping Trip 🏕️',
  title: 'New Message',
  body: 'Are you coming?'
})
image

Checklist

Release Notes

Notes:

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 18, 2026
@VerteDinde VerteDinde added semver/minor backwards-compatible functionality target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 18, 2026
@bitdisaster bitdisaster force-pushed the notification-id-for-windows branch from fa28467 to 6644704 Compare March 20, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/requested 🗳 new-pr 🌱 PR opened recently semver/minor backwards-compatible functionality target/42-x-y PR should also be added to the "42-x-y" branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants