blogs
About

How Do Webhooks Work

Aug 14, 2025

#82: Break Into Webhooks Pattern (3 Minutes)
͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­
Forwarded this email? Subscribe here for more

🚨 I'm looking for someone to join me in writing about system design on my newsletter regularly.

I can offer you good compensation per article.

Let me know if interested by replying to this e-mail. (Also include 1 article you’ve written.)


How Do Webhooks Work ⭐

#82: Break Into Webhooks Pattern (3 Minutes)

Neo Kim
Aug 14
 
READ IN APP
 

Get my system design playbook for FREE on newsletter signup:

Upgrade to paid

This post outlines how webhooks work. You will find references at the bottom of this page if you want to go deeper.

  • Share this post & I'll send you some rewards for the referrals.

Once upon a time, there was an e-commerce store.

They used an external payment service to handle orders.

It means the payment service processes a payment first.

And only after that, the store sends a confirmation email to the customer.

How Do Webhooks Work

Yet they had only a tiny number of customers.

So they checked for new payments every hour through HTTP polling.

Imagine polling as repeatedly asking a server for updates.

But one day, their store became extremely popular because of a limited flash sale.

And they received a massive number of orders in a short period.

Although explosive growth is a good problem to have, they sent email notifications to customers extremely late because of delays in polling.

It was frustrating.

Polling vs Websockets
Polling vs Websockets

So they set up websockets.

Think of the websockets as a way for the client and server to communicate in real-time, in both directions.

But it needs extra work because of connection management, server scaling, and monitoring. Thus increasing the operational efforts and resource usage.

They wanted a simple way to solve this problem.

So they set up webhooks.

Imagine webhooks as a way of sending messages to an external service when specific events happen.

Onward.


Ship faster, with context-aware AI that speaks your language - Sponsor

Augment Code is the only AI coding agent built for real engineering teams.

It understands your codebase—across 10M+ lines, 10k+ files, and every repo in your stack—so it can actually help: writing functions, fixing CI issues, triaging incidents, and reviewing PRs.
All from your IDE or terminal. No vibes. Just progress.

Learn more about Augment


How Do Webhooks Work

Let’s dive in:

1. Webhook Components

A webhook isn’t a protocol, but a communication pattern.

It has 3 parts:

  • Sender: The system where the event happens (external payment service)

  • Event: The action that occurred (payment completion)

  • Receiver: The system that needs to know about the event (e-commerce store)

Webhook Components
Webhook Components

The external payment service sends an event to the e-commerce store when the customer makes a successful payment.

And the e-commerce store then sends a confirmation email to the customer.

Ready for the best part?

2. Webhook Workflow

They set up a separate API endpoint on the e-commerce store to handle webhook events. And registered its URL with the payment service.

Webhook Workflow
Webhook Workflow

Here’s the webhook workflow:

  1. The user tries to buy something from the store

  2. The user then gets sent to the payment service

  3. The payment service creates a webhook event upon successful payment

  4. The payment service sends an HTTP POST request to the store’s webhook URL

  5. The store validates the payment and emails the customer to confirm the purchase

Also the store notifies the customer in case the payment is invalid.


Webhooks let systems communicate in real time via HTTP.

Yet there’s a risk of fake data or spam reaching the webhook endpoint as it’s a public API. So it’s necessary to set up extra security using signature verification for safety.

Besides an event delivery could fail because of network issues. Because of this, it’s necessary to retry with exponential backoff until it succeeds.

But a retry might cause duplicate action, such as emailing the customer twice. So it’s necessary to set up the webhook API endpoint with idempotency.


Subscribe to get simplified case studies delivered straight to your inbox:

Upgrade to paid

Author Neo Kim; System design case studies
👋 Say hi on LinkedIn | Twitter | Threads | Instagram

Want to advertise in this newsletter? 📰

If your company wants to reach a 165K+ tech audience, advertise with me.


Thank you for supporting this newsletter.

You are now 165,001+ readers strong, very close to 166k. Let’s try to get 166k readers by 21 August. Consider sharing this post with your friends and get rewards.

Y’all are the best.

system design newsletter

Share


References

  • Red Hat - What is a webhook?

  • Github - Webhooks documentation

  • Stripe - Webhooks documentation

  • Azure - Webhooks

  • Block diagrams created with Eraser

Share this post & I'll send you some rewards for the referrals.

 
Like
Comment
Restack
 

© 2025 Neo Kim
548 Market Street PMB 72296, San Francisco, CA 94104
Unsubscribe

Get the appStart writing



blogs

  • blogs
  • blogs@replies.catskull.net
  • catskull

Blogging like it's 1999.