← Back to all products
$19
Notification System
Multi-channel notification engine for email, webhook, in-app, and SMS with template system.
PythonMarkdown
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
notification-system/
├── LICENSE
├── README.md
├── examples/
│ └── basic_example.py
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ └── 03_project-structure.md
├── index.html
└── src/
└── main.py
📖 Documentation Preview README excerpt
Notification System
A Python notification engine for SaaS applications. Supports email, webhook, in-app, and SMS channels with a template system, scheduling, per-user preferences, delivery tracking, and retry logic — all built on Python's standard library.
Features
- Multi-channel delivery — Email, webhook, in-app, and SMS (via pluggable adapters)
- Template engine — Reusable notification templates with variable interpolation
- Scheduling — Send immediately or schedule for a future time
- User preferences — Per-user channel opt-in/opt-out with global defaults
- Delivery tracking — Track sent, delivered, failed, and pending status per notification
- Retry logic — Automatic retries with exponential backoff for failed deliveries
- Batch sending — Send one notification to many recipients efficiently
- Priority levels — Critical, high, normal, low — with priority-based queue ordering
- Digest mode — Aggregate low-priority notifications into periodic digests
- Audit trail — Full history of every notification sent, to whom, and delivery result
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
python src/main.py --init-demo
# Send a notification
curl -X POST http://localhost:8008/api/notifications \
-H "Content-Type: application/json" \
-d '{"recipient_id": "user_1", "channel": "email", "template": "welcome", "variables": {"name": "Alice"}}'
# Send to multiple recipients
curl -X POST http://localhost:8008/api/notifications/batch \
-H "Content-Type: application/json" \
-d '{"recipient_ids": ["user_1", "user_2"], "channel": "in_app", "template": "announcement", "variables": {"message": "New feature launched!"}}'
# List notifications for a user
curl http://localhost:8008/api/notifications/user_1
# Check delivery status
curl http://localhost:8008/api/notifications/status/notif_abc123
# Manage templates
curl http://localhost:8008/api/templates
# Update user preferences
curl -X PUT http://localhost:8008/api/preferences/user_1 \
-H "Content-Type: application/json" \
-d '{"email": true, "sms": false, "in_app": true, "webhook": false}'
# Process pending scheduled notifications
curl -X POST http://localhost:8008/api/notifications/process-queue
API Endpoints
| Method | Path | Description |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
examples/basic_example.py#!/usr/bin/env python3
"""
Notification System — Basic Usage Example
===========================================
Demonstrates creating templates, sending notifications, batch delivery,
checking preferences, processing the queue, and viewing delivery status.
Run: python3 basic_example.py
"""
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src"))
from main import NotificationEngine
def main() -> None:
print("=== Notification System — Basic Example ===\n")
engine = NotificationEngine(data_dir=Path("/tmp/notification-demo"))
# --- 1. Create notification templates ---
engine.create_template(
"welcome", "email",
subject="Welcome to {{app_name}}, {{name}}!",
body="Hi {{name}},\n\nWelcome aboard! Your {{app_name}} account is ready.\n\n"
"Get started: https://app.example.com/onboarding\n\nCheers,\nThe Team",
)
engine.create_template(
"alert", "in_app",
subject="{{title}}",
body="{{message}}",
)
engine.create_template(
"invoice", "email",