๐Ÿช

Webhook

HTTP Callback on Event Trigger

Webhooks are also called "reverse APIs". While traditional APIs have the client requesting the server, Webhooks have the server directly sending data to the client's endpoint when an event occurs.

Architecture Diagram

Pre-registration Phase
๐Ÿ–ฅ๏ธ
My Server
Provides callback URL
โ‘  Register URL
โ˜๏ธ
External Service
e.g. GitHub, Stripe
When Event Occurs
๐Ÿ–ฅ๏ธ
My Server
Receive POST + Process
โ‘ก HTTP POST Callback
โšก
Event Triggered!
Payment complete, code push, etc.
Flow Description
  1. Pre-register my server's callback URL with the external service
  2. When an event occurs, the external service sends HTTP POST to the registered URL
  3. My server receives and processes the event
  4. Real-time notifications without polling

How It Works

1

Register your server's callback URL with the external service

2

Event occurs in external service (payment completed, code push, etc.)

3

External service sends HTTP POST request to registered URL

4

Your server receives the request and processes the event

Pros

  • Real-time event reception
  • No polling needed (efficient)
  • Relatively simple to implement
  • Loose coupling

Cons

  • Public URL required
  • Retry logic needed on failure
  • Difficult to guarantee ordering
  • Security verification needed (signature validation)

Use Cases

GitHub Webhook (code push notifications) Stripe payment notifications Slack event subscriptions CI/CD pipeline triggers