Skip to content

feat: add id and groupId options to macOS notifications#50097

Merged
VerteDinde merged 5 commits into
mainfrom
feat-notification-custom-id
Mar 16, 2026
Merged

feat: add id and groupId options to macOS notifications#50097
VerteDinde merged 5 commits into
mainfrom
feat-notification-custom-id

Conversation

@VerteDinde
Copy link
Copy Markdown
Member

Description of Change

This PR is the first in a series of future PRs to expand the notifications API with new features on MacOS and Windows, now that we have access to Apple's UNNotification API.

This PR specifically adds a id string option to the Notification constructor on macOS, allowing users to assign a stable, custom identifier to notifications. It also adds a groupId option to the Notification constructor, mapping to the UNNotificationContent.threadIdentifier property on macOS. Notifications with the same groupId will be visually grouped together in the Notification Center. When an id is not provided, the current behavior is unchanged.

This behavior will be expanded to support additional operating systems in a future PR.

Checklist

Release Notes

Notes: Added id and groupId options to the Notification constructor on macOS. id allows custom identifiers for notifications, and groupId visually groups notifications together in Notification Center.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 5, 2026
@VerteDinde VerteDinde force-pushed the feat-notification-custom-id branch from b704de9 to 0f2700b Compare March 5, 2026 23:24
@VerteDinde VerteDinde force-pushed the feat-notification-custom-id branch from 0f2700b to 01bf522 Compare March 6, 2026 21:36
@VerteDinde VerteDinde marked this pull request as ready for review March 6, 2026 21:37
@VerteDinde VerteDinde added the semver/minor backwards-compatible functionality label Mar 6, 2026
Comment thread docs/api/notification.md Outdated
Comment thread docs/api/notification.md Outdated
Comment thread docs/api/notification.md Outdated
Comment thread shell/browser/api/electron_api_notification.cc Outdated
Copy link
Copy Markdown
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

Copy link
Copy Markdown
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

Comment thread docs/api/notification.md
Comment on lines +82 to +83
* `id` string (optional) _macOS_ - A unique identifier for the notification, mapping to `UNNotificationRequest`'s [`identifier`](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) property. Defaults to a random UUID if not provided or if an empty string is passed. This can be used to remove or update previously delivered notifications.
* `groupId` string (optional) _macOS_ - A string identifier used to visually group notifications together in Notification Center. Maps to `UNNotificationContent`'s [`threadIdentifier`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/threadidentifier) property.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open to discussion on this, but this feels like it should go closer to the bottom of the API doc (assuming that people would care the most about title/body/icon for this API)

@VerteDinde VerteDinde added target/42-x-y PR should also be added to the "42-x-y" branch. and removed no-backport labels Mar 16, 2026
@VerteDinde VerteDinde enabled auto-merge (squash) March 16, 2026 19:40
Copy link
Copy Markdown
Contributor

@bitdisaster bitdisaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VerteDinde VerteDinde merged commit 958278c into main Mar 16, 2026
113 of 115 checks passed
@VerteDinde VerteDinde deleted the feat-notification-custom-id branch March 16, 2026 20:24
@release-clerk
Copy link
Copy Markdown

release-clerk Bot commented Mar 16, 2026

Release Notes Persisted

Added id and groupId options to the Notification constructor on macOS. id allows custom identifiers for notifications, and groupId visually groups notifications together in Notification Center.

@trop
Copy link
Copy Markdown
Contributor

trop Bot commented Mar 16, 2026

I have automatically backported this PR to "42-x-y", please check out #50304

@trop trop Bot added in-flight/42-x-y merged/42-x-y PR was merged to the "42-x-y" branch. and removed target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/42-x-y labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/approved ✅ merged/42-x-y PR was merged to the "42-x-y" branch. semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants