DEV Community

Tanya Jha
Tanya Jha

Posted on

What is a Webhook. Explained the way I wish someone had told me.

When I first heard the word webhook, I imagined some scary backend magic 😭

But it’s actually one of those concepts that sounds harder than it is.

Imagine this:

You’re waiting for your crush to reply.

Option 1: You open WhatsApp every 30 seconds.

Seen? No.
Seen now? No.
Now?? Still no.

That’s like an API.

You keep asking:
β€œAny update?”
β€œAny update?”
β€œAny update?”

Option 2: You close the app and continue your life.

Then suddenly:
✨ ding
New message.

  • You didn’t ask.
  • You got notified.
  • That’s a webhook.

Webhook = β€œDon’t keep checking. I’ll tell you when something happens.”

Real life examples:

πŸ’³ You make a payment β†’ payment successful β†’ website gets notified

πŸ“¦ Your package gets delivered β†’ app automatically updates status

πŸ“§ Someone signs up β†’ welcome email gets sent instantly

πŸ›’ You place an order β†’ confirmation arrives automatically

Tiny code example:

Someone buys a hoodie.

Store receives:

POST /order-confirmed
{
β€œorder”: β€œ#1042”,
β€œstatus”: β€œpaid”
}

Store instantly shows: βœ… Order Confirmed

No refreshing.
No checking again and again.

So the easiest difference:

API β†’ β€œAre we there yet?”
Webhook β†’ β€œI’ll let you know when we arrive.”

And suddenly webhook sounds way less scary πŸ™‚

Top comments (0)