Chapter 6: Notification Systems
The Engagement Loop
Comments are a conversation. Without notifications, users post and leave, never returning to see responses. A good notification system creates an engagement loop that brings users back and builds community. This chapter explores how to implement notifications effectively.
Types of Notifications
Reply Notifications
The most essential notification type:
- Someone replies to your comment
- Creates conversation threads
- Highest engagement value
Mention Notifications
When someone references a user:
- @username mentions
- Pulls users into conversations
- Requires user identity system
Post Activity Notifications
For post authors:
- New comment on your post
- Comment milestone notifications
- Daily/weekly digest options
Subscription Notifications
For interested readers:
- Subscribe to a post’s comments
- Subscribe to a user’s comments
- Subscribe to topics/tags
Moderation Notifications
For moderators and admins:
- New comments requiring review
- User flags on comments
- Spam detection alerts
Delivery Channels
Email
The most universal notification channel.
Advantages:
- Everyone has email
- Works offline
- Permanent record
- Rich formatting possible
Disadvantages:
- Deliverability challenges
- Spam folder risk
- Email fatigue
- Delayed reading
Best practices:
- Clear sender name and subject
- Easy unsubscribe
- Batch similar notifications
- Mobile-friendly formatting
Web Push
Browser-based notifications:
Advantages:
- Instant delivery
- High visibility
- Works across tabs
- No email needed
Disadvantages:
- Requires permission
- Only when browser open (usually)
- Limited formatting
- Users often decline
Considerations:
- Respect permission denials
- Don’t over-notify
- Provide value immediately
- Easy to disable
In-App Notifications
Notifications within your site:
Advantages:
- Full control over experience
- No deliverability issues
- Rich interactions possible
- No external dependencies
Disadvantages:
- Only seen when on site
- Requires return visit
- Storage and retrieval needed
- Another system to build
Features:
- Notification center/inbox
- Unread count badge
- Mark read/unread
- Notification history
Mobile Push (Native Apps)
If you have a mobile app:
Advantages:
- High visibility
- Works when app closed
- Badge counts
- Rich notifications
Disadvantages:
- Requires app development
- Platform-specific implementation
- Push service costs
- User permission needed
Other Channels
RSS Feeds:
- Comments RSS for power users
- Low maintenance
- Self-service subscription
Webhooks:
- For technical users
- Integration capabilities
- Automation potential
Email Notification Deep Dive
Email is typically the primary notification channel.
Deliverability
Your emails must reach inboxes:
Authentication:
- SPF records configured
- DKIM signing enabled
- DMARC policy set
Reputation:
- Dedicated IP or reputable service
- Consistent sending patterns
- Monitor bounce rates
- Handle complaints properly
Content:
- Avoid spam trigger words
- Text and HTML versions
- Clear unsubscribe link
- Professional formatting
Email Service Options
Self-Hosted:
- Full control
- Deliverability challenges
- Maintenance burden
- IP reputation building
Transactional Email Services:
- Mailgun, SendGrid, Postmark, Amazon SES
- Better deliverability
- Usage-based pricing
- Delivery tracking
Considerations:
- Free tier limits
- Cost at scale
- Feature requirements
- Reliability needs
Email Content Design
Subject Lines:
- Clear and specific
- Include context (“Re: [Post Title]”)
- Avoid clickbait
- Keep concise
Body Content:
- Context (what post, what comment)
- The reply content
- Clear call to action
- Unsubscribe option
Formatting:
- Mobile-first design
- Plain text fallback
- Minimal images
- Readable fonts
Batching and Digests
Don’t overwhelm users:
Immediate:
- Direct replies
- Urgent notifications
- Opt-in for this frequency
Batched:
- Collect notifications over period
- Send combined email
- Reduces volume
Digest:
- Daily or weekly summary
- All activity in one email
- Good for low-engagement users
Notification Preferences
Users should control their notifications.
Preference Categories
By Type:
- Replies to my comments
- Mentions
- New comments on followed posts
- Moderation notifications
By Channel:
- Email notifications
- Push notifications
- In-app only
By Frequency:
- Immediate
- Batched (hourly)
- Daily digest
- Weekly digest
- None
Default Settings
Choose sensible defaults:
- Err toward less notification
- Essential notifications on
- Marketing-type notifications off
- Easy to adjust
Unsubscribe Handling
One-Click Unsubscribe:
- Required by law (CAN-SPAM)
- Link in every email
- Immediate effect
- No login required
Granular Unsubscribe:
- Option to reduce vs. stop all
- Preference center link
- Re-subscribe possible
Implementation Architecture
Event-Driven Design
Event Generation:
- New comment → CommentCreated event
- Reply → ReplyCreated event
- Mention detected → MentionCreated event
Event Processing:
- Events trigger notification logic
- Determine recipients
- Apply preferences
- Queue for delivery
Delivery:
- Process notification queue
- Handle failures and retries
- Track delivery status
Queue-Based Processing
Notifications should be asynchronous:
Why Queue:
- Don’t slow comment submission
- Handle delivery failures
- Rate limiting possible
- Batch processing enabled
Queue Options:
- Database-backed queues
- Message brokers (Redis, RabbitMQ)
- Cloud services (SQS, Cloud Tasks)
- Simple file-based for low volume
Tracking and Reporting
Track notification performance:
Delivery Metrics:
- Sent count
- Delivery rate
- Bounce rate
- Open rate (if tracking)
Engagement Metrics:
- Click-through rate
- Return visit rate
- Reply rate
- Unsubscribe rate
Preventing Notification Fatigue
Too many notifications cause users to tune out or unsubscribe.
Smart Throttling
Per-User Limits:
- Maximum notifications per hour/day
- Combine when exceeded
- Escalation for important ones
Conversation Collapsing:
- Multiple replies to same comment
- Combine into one notification
- “3 people replied to your comment”
Activity-Based:
- If user is active on site, delay notifications
- They’ll see it directly
- Reduces redundancy
Quality Over Quantity
Filter Low-Value:
- Single-emoji replies
- Very short comments
- Automated/bot comments
Highlight High-Value:
- Detailed replies
- From notable users
- On popular content
Real-Time Considerations
For sites wanting instant notifications:
WebSockets
Keep connection open for instant delivery:
Advantages:
- True real-time
- Immediate delivery
- Bidirectional communication
Disadvantages:
- Connection overhead
- Scaling complexity
- Infrastructure requirements
Server-Sent Events (SSE)
Simpler than WebSockets:
Advantages:
- Simpler implementation
- HTTP-based
- Works through proxies
Disadvantages:
- One-directional
- Reconnection handling
- Still requires maintained connections
Polling
Periodic checks for new notifications:
Advantages:
- Simple implementation
- Works everywhere
- Stateless
Disadvantages:
- Not truly real-time
- Server load from frequent polls
- Battery/bandwidth usage
Cost Considerations
Email Costs
Transactional Services:
- Often free tier (1,000-10,000/month)
- Then usage-based pricing
- $0.10-1.00 per 1,000 emails typical
Self-Hosted:
- Server costs
- Deliverability investment
- Maintenance time
Push Notification Costs
Web Push:
- Generally free (browser-handled)
- Infrastructure for sending minimal
Mobile Push:
- Platform services free (APNS, FCM)
- Management services may cost
Infrastructure Costs
Queue Processing:
- Serverless: pay per execution
- Server-based: included in hosting
- Managed services: usage-based
Privacy and Compliance
Data Handling
- Store minimal notification data
- Clear retention policy
- Handle deletion requests
- Don’t leak information in notifications
Consent
- Clear opt-in for marketing
- Legitimate interest for transactional
- Easy opt-out always
- Record consent
Content in Notifications
- Consider what’s included
- Partial content vs. full
- Privacy of other users
- Secure delivery
Summary
Effective notification systems:
- Enable conversation: Reply notifications are essential
- Respect users: Preferences and easy unsubscribe
- Multiple channels: Email primary, supplement with others
- Prevent fatigue: Smart batching and throttling
- Track performance: Measure and improve
Start simple with email reply notifications and expand based on user feedback and engagement data.
The next chapter addresses performance considerations—making your comment system fast and scalable.