IN_APP channel stores notification payloads in the database instead of dispatching to external carriers. This gives you a fast, reliable mechanism for populating user-facing activity feeds.
Reading and Marking Feeds
Applications read from and update the state of theinapp_notifications table:
- Polling: Query unread items on a periodic loop (e.g. every 15s) from your web components.
- Server-Sent Events (SSE): Establish persistent socket-like streaming channels to display instant feed increments without polling.
Database Schema Structure
The underlying table layout is defined inschema.prisma:
Building a Notification UI
For a premium user experience, follow these design guidelines in your client-side implementation:- Badges: Use a badge (e.g. rose-600 background) displaying the unread notification count on top of a Bell icon.
- Smooth Dismissal: Trigger a fast optimistic UI update, hiding the dismissed element instantly while launching the mark-as-read
POSTcall in the background. - Empty States: Render a clean illustration and description (e.g., “All caught up!”) when there are no unread notifications.
Developer Implementation
1. Triggering an In-App Notification
To trigger an in-app notification for a user, callPOST /api/v1/notify specifying IN_APP as the channel: