Serksa
All Concepts
API & Backend

Webhooks Explained

1

What is it?

<strong>Webhooks</strong> are automated messages sent from one app to another when a specific event happens. Instead of constantly checking for updates (polling), the app notifies you immediately when something changes.

2

Think of it like...

The Doorbell Analogy

Instead of checking your door every 5 minutes (polling), you wait for the doorbell to ring (webhook). The delivery service notifies you exactly when your package arrives.

🏠

Your House (Your App)

Waiting for delivery

🔔

Doorbell (Webhook)

Notifies you

📦

Delivery (Event)

Package arrives

3

Visual Flow

🎯Event Occurs

Payment Completed

📡Webhook Fires

HTTP POST Request

🖥️Your Server

Receives Notification

4

Where you see it

1

Register webhook URL

Tell the service where to send notifications

2

Event happens

User makes payment, creates account, etc.

3

Service sends HTTP POST

Immediately sends data to your webhook URL

4

Your server receives

Process the event data

5

Respond with 200 OK

Confirm you received the webhook

5

Common Mistake

Wrong

"Webhooks and APIs are the same"

Correct

<strong>APIs are pull (you request), webhooks are push (they notify)</strong>. APIs require you to ask for data; webhooks automatically send data when events occur.

💡 Real-World Example

Stripe payment webhooks:

1

User completes payment on your site

2

Stripe immediately sends webhook to your server

3

Your server receives payment confirmation

4

You can update order status, send email, etc. in real-time