← Back to all products

Webhook Framework

$29

Webhook delivery system with retry logic, signature verification, event sourcing, and monitoring dashboard.

29 files
PythonMarkdownJSONRedisPostgreSQL

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 29 files

webhook-framework/ ├── LICENSE ├── README.md ├── examples/ │ ├── sample-events.json │ ├── send_webhook.py │ └── verify_signature.py ├── free-sample.zip ├── guide/ │ ├── event-sourcing.md │ ├── retry-and-idempotency.md │ └── signature-verification.md ├── guides/ │ ├── event-sourcing.md │ ├── retry-and-idempotency.md │ └── signature-verification.md ├── index.html ├── interactive.html ├── src/ │ ├── __init__.py │ ├── __pycache__/ │ │ ├── __init__.cpython-312.pyc │ │ ├── delivery.cpython-312.pyc │ │ └── signatures.cpython-312.pyc │ ├── dashboard.py │ ├── delivery.py │ ├── event_store.py │ ├── receiver.py │ └── signatures.py ├── templates/ │ └── dashboard.html └── tests/ ├── __pycache__/ │ ├── test_delivery_retry.cpython-312-pytest-9.0.2.pyc │ └── test_signatures.cpython-312-pytest-9.0.2.pyc ├── test_delivery_retry.py └── test_signatures.py

Documentation Preview README excerpt

Webhook Framework

A complete webhook delivery system with HMAC signature verification, exponential backoff retry, SQLite-backed event sourcing, and an HTML monitoring dashboard. Zero external dependencies -- Python 3.10+ standard library only.

Features

  • Webhook delivery engine with configurable retry logic (exponential backoff + full jitter)
  • HMAC-SHA256 signatures with timestamp binding to prevent replay attacks
  • Append-only event store on SQLite for full delivery audit trail
  • Webhook receiver with signature verification, idempotency checking, and event routing
  • Monitoring dashboard that renders delivery stats as an HTML page
  • Idempotency keys to prevent duplicate processing on retries
  • Dead letter tracking for permanently failed deliveries

Quick Start

1. Start the Webhook Receiver


cd webhook-framework
python -m src.receiver --port 9000 --secret whsec_demo_secret_key

2. Send a Webhook (in another terminal)


python examples/send_webhook.py

3. View the Dashboard


python -m src.dashboard --port 8080 --db webhook_events.db
# Open http://127.0.0.1:8080

4. Run the Signature Demo


python examples/verify_signature.py

5. Run Tests


python -m unittest discover tests/ -v

Architecture


Sender                          Receiver
  │                                │
  │  1. Sign payload (HMAC-SHA256) │
  │  2. POST with retry logic     │
  │  ─────────────────────────────>│
  │                                │  3. Verify signature
  │                                │  4. Check idempotency key
  │                                │  5. Process event
  │  <─────────────────────────────│  6. Return 200 OK

*... continues with setup instructions, usage examples, and more.*

Code Sample .py preview

src/dashboard.py """ Webhook Monitoring Dashboard ============================== Generates an HTML monitoring dashboard from the event store data. Runs as a simple HTTP server that renders real-time webhook statistics. Uses only stdlib: http.server for serving, string.Template for HTML rendering. Usage: python -m src.dashboard # Default port 8080 python -m src.dashboard --port 8888 --db events.db """ from __future__ import annotations import argparse import json import logging import time from http.server import HTTPServer, BaseHTTPRequestHandler from pathlib import Path from string import Template from typing import Any from .event_store import EventStore logger = logging.getLogger("webhook.dashboard") # Path to the HTML template TEMPLATE_DIR = Path(__file__).resolve().parent.parent / "templates" def _load_template() -> str: """Load the dashboard HTML template, or use embedded fallback.""" template_path = TEMPLATE_DIR / "dashboard.html" if template_path.exists(): return template_path.read_text(encoding="utf-8") # Embedded fallback template if the file isn't found return """<!DOCTYPE html> <html><head><title>Webhook Dashboard</title> <style>body{font-family:sans-serif;margin:2em;background:#f5f5f5} .card{background:white;padding:1.5em;margin:1em 0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1)} .stat{display:inline-block;margin:0 2em;text-align:center} .stat .value{font-size:2em;font-weight:bold;color:#2563eb} .stat .label{color:#6b7280;font-size:0.85em} table{width:100%;border-collapse:collapse} th,td{padding:8px 12px;text-align:left;border-bottom:1px solid #e5e7eb} th{background:#f9fafb;font-weight:600} # ... 179 more lines ...