Modern SaaS backends rely on dozens of external webhook producers—Workday, Stripe, Razorpay, HubSpot, Shopify. Transport-level retries (502 / 504 exponential backoff) are a solved problem.

Silent payload contract drift is not.

Picture a Tuesday afternoon in production. An upstream vendor ships a minor v2 update and quietly renames "email" to "candidate_email" in their JSON payload:

{ "candidate_id": "WD-9042", - "email": "priya.sharma@enterprise.io", // What your backend expects + "candidate_email": "priya.sharma@enterprise.io", // What the vendor now sends "job_code": "STAFF-NET-01" } 

What happens next in most production stacks?

  1. Your ingestion endpoint rejects the payload with 400 Bad Request or throws a NullReferenceException.
  2. Existing webhook gateways (Hookdeck, Svix, Convoy) dutifully retry the exact same broken payload until it expires in a Dead-Letter Queue (DLQ).
  3. Worse: if you store raw failed webhooks in gateway logs—or pipe raw payloads straight into an LLM to "auto-fix" them—you just leaked customer PII (names, emails, payment metadata) across logs and third-party model APIs.

To solve both problems cleanly, I built VigilHook—a Zero-PII, self-healing webhook gateway and DLQ observability console powered by .NET 9, Angular 19, and Neon PostgreSQL.

Why Naive "AI Webhook Proxies" Fail in Production

When developers first think about combining LLMs with webhook gateways, the instinctive design is to put an LLM call inline on failed requests. In production, that breaks down across three dimensions:

  1. Latency & Upstream Timeouts: Webhook producers enforce tight 3s–10s timeouts. Waiting on LLM inference synchronously causes cascading retries and duplicate events.
  2. Recurring Token Cost: Paying for LLM tokens on every drifted webhook scales linearly with traffic spikes.
  3. PII Compliance Violations: Customer emails, phone numbers, and tokens should never sit in plaintext gateway logs or leave your security boundary unmasked.

The 4 Architectural Pillars of VigilHook

Instead of putting AI in the hot path, VigilHook uses a four-stage architecture where AI learns once, C# verifies deterministically, and customer PII never leaves the memory boundary.

1. Edge Ingress & Zero-PII Boundary

Every incoming POST /api/webhooks/{source} first passes an X-Idempotency-Key check to block duplicate vendor retries.

Next, the payload splits into two isolated paths in memory before touching the database:

  • Audit & AI Path (PiiSanitizer): Traverses the JsonNode tree and masks sensitive fields (email, phone, name, tokens) into structural markers like "[REDACTED_EMAIL]" and "[REDACTED_PII]".
  • Ephemeral Replay Vault (IDataProtectionProvider): Encrypts the intact raw payload using ASP.NET Core Data Protection (AES-256) solely so it can be replayed losslessly after repair.

2. Bounded System.Threading.Channels Quarantine

When a payload misses a required contract field (e.g., "email" is missing), VigilHook does not make the vendor wait for an LLM:

  • It persists the redacted event as Failed_SchemaDrift.
  • It returns 202 Accepted immediately so the producer never times out.
  • It pushes WebhookEvent.Id into a bounded System.Threading.Channels.Channel<Guid> processed asynchronously by a BackgroundService (DlqWorker).
// Decoupling edge ingestion (202 Accepted) from background AI schema analysis await _dlqChannel.Writer.WriteAsync(webhookEvent.Id, cancellationToken); return Accepted(new { eventId = webhookEvent.Id, status = "Failed_SchemaDrift" }); 

3. Zero-PII AI Diagnosis + Deterministic C# Guardrails

DlqWorker sends only the PII-redacted JSON structure to a pluggable ILlmService (supporting OpenRouter, Groq, or air-gapped local Ollama).

More importantly, VigilHook never trusts raw LLM output blindly:

  • A deterministic C# JsonDocument verifier confirms that every source key proposed by the LLM actually exists in the incoming payload, and every target key exists in IntegrationSchema.RequiredFields.
  • Hallucinated field names are rejected automatically before surfacing a RepairProposal to the operator.

4. One-Click Rule Promotion (< 1 ms, 0 LLM Tokens)

In the Angular 19 (Signals) operator console, an engineer inspects the side-by-side Split Diff (seeing only [REDACTED_EMAIL]), confirms the candidate_email → email mapping, and clicks Approve & Replay ↗.

Behind the scenes, VigilHook executes four atomic steps:

  1. Decrypts the raw payload from EncryptedRawPayload in memory.
  2. Applies the JSON key patch and forwards the intact payload (200 OK) to your internal backend TargetUrl.
  3. Hard-purges the encrypted vault (EncryptedRawPayload = null)—zero raw customer data remains at rest.
  4. Promotes {"candidate_email": "email"} into IntegrationSchema.MappingRulesJson.

From that millisecond onward, every future drifted webhook from that vendor auto-heals deterministically in < 1 ms with 0 LLM tokens.

Try the Live Sandbox in 60 Seconds

You don't need to clone anything to test the full lifecycle:

  1. Open vigilhook.vercel.app and wait for the top status indicator to connect.
  2. Click + Simulate Drift (which sends a drifted Workday payload with "candidate_email" instead of "email").
  3. Open the quarantined item in DLQ Inspector—notice how PII is masked as "[REDACTED_EMAIL]" while the AI proposes candidate_email → email.
  4. Click Approve & Replay ↗ with Promote mapping rule checked.
  5. Click + Simulate Drift one more time—watch it bypass the DLQ completely and land in Traffic & Audit Log as 200 OK · Auto-Healed · 0 tokens.

Tech Stack Summary

  • Backend: .NET 9 Web API, C# 13, System.Threading.Channels, ASP.NET Core Data Protection (AES-256)
  • Database: EF Core 9 with dual-provider support (zero-config SQLite locally, Neon Serverless PostgreSQL via Npgsql in production)
  • Frontend: Angular 19 (Standalone Components, Signals, RxJS)
  • AI Layer: Pluggable ILlmService (OpenRouter, Groq, or local Ollama)

If you're building webhook infrastructure or wrestling with third-party API drift in .NET, check out the repo at github.com/Abhisheknik/VigilHook—I'd love your feedback on the channel worker pattern and Zero-PII boundary!