Adds a notifications collection to Payload where each record belongs to one recipient from an auth collection. Trusted server code creates records with a helper that supports idempotent deduplication keys. Recipients can list and read only their own notifications and mark them read. An optional polling-backed Server-Sent Events endpoint streams new notifications. Requires Payload 3.90 or later.
A durable, recipient-scoped notification inbox plugin for Payload CMS 3
Installation
npm i payload-plugin-notifications3
Stars
0
Forks
0
Open Issues
2 months ago
Last Updated
12
Weekly Downloads
v1.1.0
npm Version
44.5 KB
Unpacked Size
0
Dependencies
3+3 since Sep 27
| Date | Stars |
|---|---|
| Dec 5, 2026 | 3 |
| Dec 4, 2026 | 3 |
| Dec 3, 2026 | 3 |
| Dec 2, 2026 | 3 |
| Dec 1, 2026 | 3 |
| Nov 30, 2026 | 3 |
| Nov 29, 2026 | 3 |
| Nov 28, 2026 | 3 |
| Nov 27, 2026 | 3 |
| Nov 26, 2026 | 3 |
| Nov 25, 2026 | 3 |
| Nov 24, 2026 | 3 |
| Nov 23, 2026 | 3 |
| Nov 22, 2026 | 3 |
| Nov 21, 2026 | 3 |
| Nov 20, 2026 | 3 |
| Nov 19, 2026 | 3 |
| Nov 18, 2026 | 3 |
| Nov 17, 2026 | 3 |
| Nov 16, 2026 | 3 |
| Nov 15, 2026 | 3 |
| Nov 14, 2026 | 3 |
| Nov 13, 2026 | 3 |
| Nov 12, 2026 | 3 |
| Nov 11, 2026 | 3 |
| Nov 10, 2026 | 3 |
| Nov 9, 2026 | 3 |
| Nov 8, 2026 | 3 |
| Nov 7, 2026 | 3 |
| Nov 6, 2026 | 3 |
| Nov 5, 2026 | 3 |
| Nov 4, 2026 | 3 |
| Nov 3, 2026 | 3 |
| Nov 2, 2026 | 3 |
| Nov 1, 2026 | 3 |
| Oct 31, 2026 | 3 |
| Oct 30, 2026 | 3 |
| Oct 29, 2026 | 3 |
| Oct 28, 2026 | 3 |
| Oct 27, 2026 | 3 |
| Oct 26, 2026 | 3 |
| Oct 25, 2026 | 3 |
| Oct 24, 2026 | 3 |
| Oct 23, 2026 | 3 |
| Oct 22, 2026 | 3 |
| Oct 21, 2026 | 3 |
| Oct 20, 2026 | 3 |
| Oct 19, 2026 | 3 |
| Oct 18, 2026 | 3 |
| Oct 17, 2026 | 3 |
| Oct 16, 2026 | 3 |
| Oct 15, 2026 | 2 |
| Oct 14, 2026 | 2 |
| Oct 13, 2026 | 1 |
| Oct 12, 2026 | 1 |
| Oct 11, 2026 | 1 |
| Oct 10, 2026 | 1 |
| Oct 9, 2026 | 1 |
| Oct 8, 2026 | 1 |
| Oct 7, 2026 | 1 |
| Oct 6, 2026 | 1 |
| Oct 5, 2026 | 1 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
5−265 since Oct 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 5 |
| Dec 4, 2026 | 5 |
| Dec 3, 2026 | 3 |
| Dec 2, 2026 | 4 |
| Dec 1, 2026 | 6 |
| Nov 30, 2026 | 6 |
| Nov 29, 2026 | 5 |
| Nov 28, 2026 | 5 |
| Nov 27, 2026 | 8 |
| Nov 26, 2026 | 8 |
| Nov 25, 2026 | 6 |
| Nov 24, 2026 | 4 |
| Nov 23, 2026 | 4 |
| Nov 22, 2026 | 6 |
| Nov 21, 2026 | 6 |
| Nov 20, 2026 | 6 |
| Nov 19, 2026 | 7 |
| Nov 18, 2026 | 7 |
| Nov 17, 2026 | 7 |
| Nov 16, 2026 | 8 |
| Nov 15, 2026 | 9 |
| Nov 14, 2026 | 9 |
| Nov 13, 2026 | 8 |
| Nov 12, 2026 | 9 |
| Nov 11, 2026 | 11 |
| Nov 10, 2026 | 12 |
| Nov 9, 2026 | 12 |
| Nov 8, 2026 | 10 |
| Nov 7, 2026 | 12 |
| Nov 6, 2026 | 9 |
| Nov 5, 2026 | 7 |
| Nov 4, 2026 | 5 |
| Nov 3, 2026 | 5 |
| Nov 2, 2026 | 8 |
| Nov 1, 2026 | 8 |
| Oct 31, 2026 | 6 |
| Oct 30, 2026 | 6 |
| Oct 29, 2026 | 6 |
| Oct 28, 2026 | 6 |
| Oct 27, 2026 | 14 |
| Oct 26, 2026 | 13 |
| Oct 25, 2026 | 16 |
| Oct 24, 2026 | 18 |
| Oct 23, 2026 | 18 |
| Oct 22, 2026 | 19 |
| Oct 21, 2026 | 21 |
| Oct 20, 2026 | 12 |
| Oct 19, 2026 | 10 |
| Oct 18, 2026 | 9 |
| Oct 17, 2026 | 10 |
| Oct 16, 2026 | 13 |
| Oct 15, 2026 | 17 |
| Oct 14, 2026 | 34 |
| Oct 13, 2026 | 77 |
| Oct 12, 2026 | 346 |
| Oct 11, 2026 | 343 |
| Oct 10, 2026 | 340 |
| Oct 9, 2026 | 337 |
| Oct 8, 2026 | 332 |
| Oct 7, 2026 | 313 |
| Oct 6, 2026 | 270 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1403694868-root)<a href="https://payloaddirectory.dev/plugins/1403694868-root"><img src="https://payloaddirectory.dev/badge/1403694868-root.svg" alt="Payload Directory"></a>README
A Payload 3 plugin for a durable notification inbox scoped to the authenticated recipient. The package adds a notifications collection and exports a helper for creating records from trusted server code.
Install this package in a Payload 3 project and add the plugin to buildConfig. The configured auth collection must be an authentication-enabled collection.
import { buildConfig } from 'payload'
import { notificationsPlugin } from 'payload-plugin-notifications'
export default buildConfig({
collections: [Users],
plugins: [
notificationsPlugin({
authCollection: 'users',
streaming: {
enabled: true,
pollIntervalMs: 1000,
},
}),
],
// database, editor, secret, and other application config
})
Options and defaults:
| Option | Default | Purpose |
|---|---|---|
enabled | true | Disable collection registration when false. |
collectionSlug | notifications | Slug for the generated collection. |
authCollection | users | Collection related to each recipient. |
recipientField | recipient | Name of the recipient relationship. |
readAtField | readAt | Name of the read timestamp. |
deduplicationField | dedupeKey | Name of the optional unique idempotency key. |
streaming.enabled | false | Add the authenticated SSE endpoint. |
streaming.path | /notifications/stream | Path of the SSE endpoint under Payload's API route. |
streaming.pollIntervalMs | 1000 | How often the open stream polls the adapter for new records; minimum 250 ms. |
The plugin reports an error if its collection slug is already in use. Configure different field names in the plugin and pass the matching recipientField and deduplicationField to createNotification when using non-default names.
Only trusted server-side code should call the helper. Authenticate and authorize the domain action before creating a record. The helper uses Payload's Local API with access override because normal collection creates are denied.
import { createNotification } from 'payload-plugin-notifications'
const notification = await createNotification({
payload,
recipientId: user.id,
type: 'comment.created',
title: 'New comment',
body: 'Someone commented on your post.',
data: { postId: 'post-123' },
dedupeKey: 'comment:123:user:456',
})
data is application-defined JSON and should be treated as untrusted content by consumers. The plugin does not turn it into a URL or navigate automatically.
Authenticated users can list and read only records whose recipient relationship matches their user ID. They can update their own readAt timestamp. Creation and deletion are denied through normal Payload access, and notification content, recipient, and deduplication key cannot be changed through normal updates.
When supplied, dedupeKey is globally unique within the notifications collection. Concurrent attempts rely on the adapter's unique constraint; when a duplicate insert fails, the helper returns the existing record for that key. Omitting the key creates a new notification each time. Deduplication keys are not scoped by recipient, so include recipient identity in keys when that matches the desired behavior.
List notifications through the normal Payload Local or REST API while authenticated. To mark one read with the Local API:
await payload.update({
collection: 'notifications',
id: notificationId,
data: { readAt: new Date().toISOString() },
user,
overrideAccess: false,
})
The same recipient access rules apply to REST requests. Deletes are disabled by default; retention cleanup should be performed by trusted server code.
Streaming is opt-in. When enabled, the plugin registers GET /api/notifications/stream (replace /api if the host config uses another API route). The endpoint authenticates the request, checks the recipient access rule on every poll, and sends newly created notification documents as notification events.
const since = new Date().toISOString()
const events = new EventSource(
`/api/notifications/stream?since=${encodeURIComponent(since)}`,
)
events.addEventListener('notification', (event) => {
const notification = JSON.parse((event as MessageEvent).data)
// Add or update it in the inbox by notification.id.
})
events.onerror = () => {
// EventSource reconnects automatically. Close it when the inbox unmounts.
}
Use the regular notifications query to load inbox history; SSE delivers changes after the supplied since cursor. The event ID lets EventSource resume after a disconnect, and consumers should upsert by notification ID because a reconnect can replay an event from the same timestamp. Same-origin EventSource requests include the user's Payload session cookie. For cross-origin use, configure credentialed CORS and construct EventSource with { withCredentials: true }.
SSE uses database polling because Payload adapters do not share a portable change-feed API. Each open client creates a query at the configured interval, so use one EventSource per signed-in client session and tune the interval for the expected connection count. The stream needs a host that supports long-lived HTTP responses; serverless platforms may impose timeouts or buffering that make SSE unsuitable. This works across app instances without in-memory pub/sub, but it is not a push notification service.
This package provides storage, recipient access control, server-side creation, and optional polling-backed SSE. It does not include WebSocket delivery, email/push/SMS adapters, an inbox UI, domain-specific event catalogs, or automatic permission seeding. It uses Payload collection fields and indexes, so schema generation/migrations remain managed by the host application's Payload adapter and workflow. The package declares Payload ^3.90.0 as its peer dependency.
The dev/ directory is a minimal Payload app using MongoDB Memory Server for integration tests.
pnpm install
pnpm test:int
pnpm lint
pnpm build
Set a DATABASE_URL and PAYLOAD_SECRET in dev/.env to run the dev app outside the test environment.
payload plugin notifications
In-dashboard notifications for the Payload admin with a live bell that updates over server-sent events
469/wk7v3
payload plugin notifications
In-site notices with per-kind email copies, user preferences and a retrying send queue
74127/wk0v3
payload notifications
Notifications collection with channels, per-user subscriptions, read state and optional web push delivery
67141/wk1v3
payload
Push publish, update and delete events from Payload to Hibira and refresh Next.js pages automatically
6814/wk0v3
telegram
Send Telegram messages when Payload form builder forms are submitted, with optional UTM data
76499/wk0v4
smstunnel payload
Send SMS from Payload hooks, endpoints and jobs through your own Android phone and number
6417/wk0v3