惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位
罗磊的独立博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
IT之家
IT之家
博客园 - 聂微东
Spread Privacy
Spread Privacy
V2EX - 技术
V2EX - 技术
S
Security Affairs
宝玉的分享
宝玉的分享
V
V2EX
C
Cisco Blogs
博客园 - Franky
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
S
Securelist
J
Java Code Geeks
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
WordPress大学
WordPress大学
W
WeLiveSecurity
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Testing Webhooks: The Pattern I Keep Reaching For
Rishi Gaurav · 2026-06-26 · via DEV Community

Three years ago, my webhook tests involved ngrok, a sleep(5) call, and crossed fingers. The current pattern uses none of those.

If you've ever tested webhook integrations, this probably sounds familiar.

Start your local application.

Launch ngrok.

Copy the temporary URL into the third-party application.

Trigger an event.

Wait a few seconds.

Hope the webhook arrives.

Add another sleep(5) because it didn't.

Run the test again.

Eventually, it works.

Until the URL changes.

Or the network hiccups.

Or your CI pipeline doesn't have access to ngrok.

Webhook testing has always been slightly awkward because you're validating an asynchronous conversation between two independent systems. Unlike a traditional API request where the client controls both the request and the response, webhooks require your application to become the server.

After building and testing webhook integrations for payment gateways, CRMs, messaging platforms, and SaaS applications, I've settled on a pattern that is simple, deterministic, and works just as well in CI as it does on a developer laptop.

It revolves around one idea:

Never test webhooks directly. Test your webhook receiver.

Here's the pattern I keep coming back to.


The "Inbox" Pattern — A Tiny HTTP Receiver with a Queue

Most webhook tests try to verify everything at once.

A webhook is sent.

Your application receives it.

Business logic runs.

The database updates.

Notifications are triggered.

Logs are written.

When something fails, it's difficult to know where the problem actually occurred.

Instead, separate reception from processing.

Imagine your webhook receiver doing only three things:

  1. Accept the HTTP request.
  2. Validate it.
  3. Place it into an inbox queue.

That's it.

Processing happens later.

Your receiver becomes extremely small.

Webhook Sender
        │
        ▼
HTTP Receiver
        │
        ▼
Inbox Queue
        │
        ▼
Business Processing

Now every stage can be tested independently.


Why This Pattern Works

The inbox acts as a temporary mailbox.

Your webhook endpoint only answers one question:

"Did we receive a valid webhook?"

Everything after that belongs to a different set of tests.

Benefits include:

  • Faster execution
  • Easier debugging
  • Better retry handling
  • Clearer separation of concerns

Instead of waiting for an entire workflow to complete, your test simply verifies:

  • HTTP 200 returned
  • Payload stored
  • Metadata captured
  • Queue entry created

The business logic can be validated separately.


A Better Mental Model

Think of your webhook endpoint like an email inbox.

Receiving the email isn't the same as processing it.

If the inbox works reliably, downstream processing becomes much easier to reason about.


Signature Verification: The Test That Catches 80% of Integration Bugs

Most webhook providers sign every request.

Examples include:

  • Stripe
  • GitHub
  • Shopify
  • Slack
  • Twilio

The sender computes a cryptographic signature.

Your receiver verifies it before trusting the payload.

Yet this is one of the most frequently skipped tests.


Why Signature Validation Matters

Imagine this request:

POST /webhook

Headers:

X-Signature:
a9f72d...

Payload:

{
  "event": "payment.completed"
}

If your signature verification is wrong, one of two things happens:

  1. Legitimate webhooks are rejected.
  2. Fake webhooks are accepted.

Neither outcome is desirable.


The Three Signature Tests Every Suite Needs

Instead of testing only the happy path, include:

Valid Signature

Expected:

200 OK

Webhook accepted.


Modified Payload

Change one character after computing the signature.

Expected:

401 Unauthorized

The payload should fail verification.


Wrong Secret

Generate the signature using an incorrect secret.

Expected:

401 Unauthorized

This single test catches an enormous number of configuration mistakes before production.

In my experience, signature verification accounts for the majority of webhook integration issues discovered during implementation.


Retry Behavior: How to Test It Without Waiting 30 Minutes

Many webhook providers retry failed deliveries.

Sometimes immediately.

Sometimes after several minutes.

Sometimes using exponential backoff.

Waiting for real retry intervals makes automated testing painfully slow.

Fortunately, you don't need to.


Fake the Clock

Instead of relying on time itself, make retry scheduling injectable.

For example:

Retry Policy

Attempt 1

Attempt 2

Attempt 3

During production:

5 min
15 min
30 min

During testing:

10 ms
20 ms
40 ms

Exactly the same logic.

Different timing.


What Should Be Tested?

A good retry suite verifies:

  • Failed delivery schedules another attempt.
  • Successful delivery stops future retries.
  • Maximum retry count is respected.
  • Duplicate retries don't create duplicate business events.

Every one of these can execute in a few hundred milliseconds.

No waiting required.


Simulate Temporary Failures

Instead of breaking the network, simply return:

HTTP 500

twice.

Then:

HTTP 200

on the third request.

Verify:

  • Three attempts occurred.
  • Final processing happened once.
  • Queue contains one completed event.

Deterministic.

Fast.

Reliable.


Out-of-Order Delivery — The Test Most Suites Skip

Here's something many engineers don't discover until production:

Webhook delivery order is not guaranteed.

Imagine two events.

Order Updated

arrives before:

Order Created

Perfectly legal.

Many providers explicitly document that ordering should not be assumed.

Yet countless applications accidentally depend on chronological delivery.


A Simple Example

Expected order:

Create Customer
↓

Activate Subscription

Actual delivery:

Activate Subscription
↓

Create Customer

If your system assumes ordering, the second event fails.

Production becomes inconsistent.


How to Test It

Instead of replaying events chronologically:

Send:

Event 2

before:

Event 1

Observe:

  • Does processing retry?
  • Is the event delayed?
  • Does the application recover automatically?

If not, you've discovered an important resilience gap.


Idempotency Matters Too

Out-of-order delivery often appears alongside duplicate delivery.

Your suite should verify:

Event A
↓

Event A
↓

Event B

creates exactly one business outcome.

The webhook may arrive twice.

The invoice should not.


The Webhook Test Template, in 40 Lines

The final pattern isn't tied to any programming language.

Almost every webhook test follows the same structure.

Arrange

Create:

  • Test payload
  • Signature
  • Receiver
  • Inbox

Act

Send:

POST /webhook


Assert Reception

Verify:

  • Status code
  • Signature validation
  • Queue entry
  • Metadata

Assert Processing

Process the inbox.

Verify:

  • Business action
  • Database changes
  • Event completion

Assert Idempotency

Replay exactly the same webhook.

Verify:

  • No duplicate records
  • No duplicate emails
  • No duplicate invoices

That's essentially the entire template.

Most webhook integrations differ only in payload shape and signature algorithm.

The testing pattern remains almost identical.


Putting It All Together

A mature webhook testing strategy usually covers five layers:

Layer What It Verifies
Receiver HTTP endpoint accepts requests
Signature Request authenticity
Inbox Reliable persistence
Processor Business logic
Idempotency Safe duplicate handling

Notice what's missing.

There are:

  • No arbitrary sleep calls.
  • No waiting for asynchronous timing.
  • No dependence on external tunnels.
  • No manual inspection.

Every component becomes deterministic.

Every failure becomes easier to diagnose.

Every test becomes suitable for local execution and continuous integration.


Final Thoughts

Webhook integrations are naturally asynchronous, but that doesn't mean your tests have to be unpredictable.

By separating webhook reception from business processing, validating signatures independently, simulating retries instead of waiting for them, and deliberately testing out-of-order delivery, you can build a test suite that's both fast and resilient.

The biggest improvement I made wasn't switching frameworks or buying another testing tool.

It was changing the architecture of the tests themselves.

Today, the same webhook tests run locally, in pull requests, and in production validation pipelines without relying on temporary tunnels, artificial delays, or manual verification.

That's exactly the kind of reliability automated testing should provide.

If you're looking for the CI integrations we ship for receiving these webhooks, explore:

https://totalshiftleft.ai/integrations

The fewer moving parts your webhook tests depend on, the more confidence you'll have when the real events start arriving in production.