← Back to all products

Notification System

$19

Multi-channel notification engine for email, webhook, in-app, and SMS with template system.

📁 9 files
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

src/main.py #!/usr/bin/env python3 """ Notification System — Multi-Channel Notification Engine ======================================================== A complete notification engine for SaaS applications. Supports email, webhook, in-app, and SMS channels with reusable templates, scheduling, per-user preferences, delivery tracking, retry logic with exponential backoff, batch sending, and priority-based queue ordering. Zero dependencies. Just run: python3 main.py Part of the SaaS Starter collection by DataNest. License: MIT """ from __future__ import annotations import argparse import hashlib import json import logging import os import re import time import uuid from collections import defaultdict from dataclasses import asdict, dataclass, field from datetime import datetime, timezone, timedelta from http.server import BaseHTTPRequestHandler, HTTPServer from pathlib import Path from typing import Any, Optional from urllib.parse import parse_qs, urlparse # --------------------------------------------------------------------------- # Configuration # --------------------------------------------------------------------------- DEFAULT_HOST = "0.0.0.0" DEFAULT_PORT = 8008 DATA_DIR = Path("./notification-data") # Channels supported by the system CHANNELS = ("email", "sms", "in_app", "webhook") # Priority levels — lower number = higher urgency PRIORITY_LEVELS = {"critical": 0, "high": 1, "normal": 2, "low": 3} # Retry config: max attempts and base delay (seconds) for exponential backoff MAX_RETRIES = 3 # ... 704 more lines ...
Buy Now — $19 Back to Products