You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: migration notification API from v2 to v3 (#7102)
## Explanation
This is a large notification architecture API change but offers dynamic
platform notifications
<details><summary>Details</summary>
<p>
Devlog: https://www.loom.com/share/ea5fc1457c224b2988fadacbfc21ca2a
</p>
</details>
Extension Preview:
MetaMask/metamask-extension#37709
Mobile Preview: MetaMask/metamask-mobile#22539
## References
https://consensyssoftware.atlassian.net/browse/ASSETS-1301
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Migrates notifications from v2 to v3, adds platform notifications and
locale-aware fetching, overhauls types/processors, and reduces
auto-expiry to 30 days.
>
> - **Notifications API migration (v2 → v3)**:
> - Endpoints: `/api/v3/notifications`,
`/api/v3/notifications/mark-as-read`.
> - Request body now `{ addresses: string[], locale, platform }`;
responses include `notification_type` and nested `payload`.
> - **New platform notifications**:
> - Added `TRIGGER_TYPES.PLATFORM` and support in processors/push
messaging.
> - Platform entries use `template` with localized `title`, `body`,
`image_url`, `cta`.
> - **Type and processor overhaul**:
> - Replace `OnChainRawNotification` with `NormalisedAPINotification`
(union of on-chain/platform); add `UnprocessedRawNotification`.
> - New OpenAPI v3 schema/types; updated guards
(`isOnChainRawNotification`) and converters (`toRawAPINotification`).
> - Replace `processOnChainNotification()` with
`processAPINotifications()` and update notification mapping.
> - **Service/Controller changes**:
> - Rename services: `getOnChainNotifications*` →
`getAPINotifications`/`getNotificationsApiConfigCached`.
> - Controller fetch path updated to use v3 + locale via new constructor
`env.locale`.
> - Auto-expiry utility added; expiry reduced from 90 to 30 days.
> - **Push handling**:
> - Update web listeners to parse v3 payloads and platform
notifications.
> - Push message builder reads nested `payload` and platform `template`.
> - **Tests/mocks**:
> - Updated mocks to v3 shapes; revised tests across
services/processors/controller to new API and types.
> - **Changelog**: Documents breaking changes, function renames,
request/response changes, and expiry policy.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
29ed5f1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts
Copy file name to clipboardExpand all lines: packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts
+38-35Lines changed: 38 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -21,19 +21,24 @@ import type { AuthenticationController } from '@metamask/profile-sync-controller
Copy file name to clipboardExpand all lines: packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts
0 commit comments