Designs and implements multi-channel notification systems with email, push, and in-app delivery. Use when you need to build a notification service, set up user notification preferences, create delivery pipelines, implement retry logic for failed notifications, or route messages across channels. Trigger words: notification system, push notifications, email notifications, in-app notifications, notification preferences, delivery tracking, unsubscribe, notification routing.
This skill enables AI agents to architect, implement, and configure multi-channel notification systems. It covers channel routing, user preference management, template rendering across formats, delivery tracking, retry logic, and compliance requirements like CAN-SPAM unsubscribe.
Every notification system needs these components:
Event Source → Notification Router → Channel Adapters → Delivery
↓ ↓
Preference Store Retry Queue
↓
Dead Letter Queue
Notification Router: Receives a typed event, resolves the user's channel preferences, and dispatches to the appropriate channel adapters.
Channel Adapters: Pluggable handlers for each delivery channel. Must implement a common interface:
interface ChannelAdapter {
channel: 'email' | 'push' | 'in-app';
send(notification: FormattedNotification): Promise<DeliveryResult>;
validateRecipient(userId: string): Promise<boolean>;
}
Preference Store: Database-backed user preferences with per-notification-type, per-channel toggles. Some notifications (transactional/security) must be non-disableable.
Always classify notifications into categories that determine default behavior:
| Category | Examples | Can Disable? | Default Channels | |----------|----------|-------------|-----------------| | Security | Password reset, 2FA | No | Email | | Transactional | Order confirm, receipt | No | Email + In-app | | Activity | Comments, mentions | Yes | Push + In-app | | Social | New follower, like | Yes | In-app | | Marketing | Digest, announcements | Yes | Email |
Email:
List-Unsubscribe header for one-click unsubscribePush Notifications:
data payload for deep linkingIn-App:
Implement exponential backoff per channel:
After max retries, move to dead letter queue with full context for debugging.
Use a single data context per notification type that renders differently per channel:
interface NotificationContext {
type: 'new-comment';
actor: { name: string; avatarUrl: string };
target: { title: string; url: string };
content: { preview: string; full: string };
}
// → Email: Full HTML with actor avatar, comment preview, and action button
// → Push: "Alex commented: 'Great analysis of the…'"
// → In-app: "Alex commented on Your Post Title" with link
Track these states for every notification:
queued → sent → delivered → read → failed
Store in a notification_deliveries table with: notification_id, user_id, channel, status, attempted_at, delivered_at, read_at, error_message.
Prompt: "Build a notification service for my Express app that sends order confirmations via email and in-app."
Output: The agent creates a BullMQ-backed router that accepts { type: 'order-confirmed', userId, data: { orderId, total, items } }, checks user preferences, and dispatches to the email adapter (SendGrid) and in-app adapter (PostgreSQL insert + Socket.io emit).
Prompt: "Create an API for users to manage their notification preferences with a React settings page."
Output: The agent generates REST endpoints for CRUD on notification preferences, a migration for the notification_preferences table with a composite unique constraint on (user_id, notification_type, channel), and a React component rendering a matrix of toggles with notification types as rows and channels as columns.
npx skills add TerminalSkills/notification-system下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer