feat: implement MailGun webhook service for logging email events
Implemented a production-ready TypeScript/Express.js service to receive and log MailGun webhook events (delivered, failed, opened, clicked, etc.). Key features: - Webhook endpoint (POST /webhook) with comprehensive event logging - Full TypeScript type definitions for all MailGun event types - Prometheus metrics integration for monitoring - Health check endpoint (GET /ping) - Comprehensive Jest test suite with 87.76% coverage - Docker containerization with build scripts Removed template/example code: - All SQL/MSSQL dependencies and related code - Example auth router and middleware - PRTG metrics support (simplified to Prometheus only) - Unused middleware (CORS, IP whitelist, request parsing/validation) - Template documentation (kept only MailGun webhook API spec) The service is clean, minimal, and focused solely on receiving and logging MailGun webhook events to the console. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
26
mailgun-webhook/.env.example
Normal file
26
mailgun-webhook/.env.example
Normal file
@@ -0,0 +1,26 @@
|
||||
# Environment Variables for MailGun Webhook Service
|
||||
# Copy this file to .env for local development
|
||||
|
||||
# Server Configuration
|
||||
PORT=3000
|
||||
|
||||
# Prometheus Monitoring
|
||||
# Label that will mark the metric in Prometheus (default: package.json name)
|
||||
PROMETHEUS_APP_LABEL=mailgun-webhook-service
|
||||
|
||||
# CSV definition of buckets for Prometheus/Grafana histogram
|
||||
PROMETHEUS_HISTOGRAM_BUCKETS=0.1,0.5,1,5,10
|
||||
|
||||
# Debug Logging
|
||||
# Enable debug output for specific namespaces
|
||||
# Examples: server:*, app:*, or * for all
|
||||
DEBUG=server:*,app:*
|
||||
|
||||
# MailGun Configuration (for future enhancements)
|
||||
# Uncomment and configure when adding webhook signature verification
|
||||
# MAILGUN_SIGNING_KEY=your-mailgun-signing-key
|
||||
# MAILGUN_WEBHOOK_TIMEOUT=30000
|
||||
|
||||
# Security Configuration (optional)
|
||||
# Uncomment to restrict webhook access to MailGun IPs only
|
||||
# ALLOWED_IPS=209.61.151.0/24,209.61.154.0/24,173.193.210.0/24
|
||||
Reference in New Issue
Block a user