A webhook is an event-driven HTTP callback mechanism that sends real-time automated payloads between web systems when specific triggers occur.
A Webhook (also termed a reverse API or HTTP push callback) is an architectural pattern that enables event-driven, real-time communication between decoupled web applications. Instead of a client polling an API server periodically to check for state updates ("Did anything happen yet?"), the receiving server provides a public endpoint URL where the publishing service initiates an automated HTTP POST request the instant an event occurs ("Payment succeeded", "Build passed", "Customer signed up").
Test, capture, and inspect incoming webhook payloads in real time with our client-side Webhook Tester tool.
| Property | Webhooks (Event-Driven Push) | Traditional Polling (Request-Response) |
|---|---|---|
| Communication Flow | Server-to-Server asynchronous push | Client-to-Server continuous pull |
| Transport Protocol | HTTP / HTTPS (Strictly POST or PUT) |
HTTP / HTTPS (GET) |
| Latency | Near zero (Milliseconds after trigger) | Bounded by polling interval (e.g., every 60 seconds) |
| Server Resource Overhead | Minimal (Executes only when events fire) | High (99%+ of polling requests return empty responses) |
| Authentication | HMAC signatures in headers (X-Signature) |
API Keys, OAuth tokens, Basic Auth |
| Delivery Guarantees | At-least-once delivery with retry backoff | Client-managed state checkpoints |
[ Third-Party Service (e.g. Stripe / GitHub) ]
│
│ 1. Event Triggers ("payment.succeeded")
│ 2. Computes HMAC SHA-256 Signature
▼
HTTP POST https://api.devflow.tools/webhooks
Headers:
Content-Type: application/json
X-Signature-SHA256: 3c8e41a...
Body: { "id": "evt_99", "amount": 4900 }
│
▼
[ Receiving App Server ]
1. Validates HMAC signature using shared secret
2. Responds immediately with HTTP 200 OK
3. Enqueues event to background worker queue
Because webhook endpoints are exposed publicly over the internet, attackers can forge fake events. Industry leaders (GitHub, Stripe, Shopify) authenticate payloads using HMAC SHA-256 signatures passed in HTTP headers:
import crypto from 'crypto';
export function verifyWebhookSignature(
rawBody: string,
signatureHeader: string,
secretKey: string
): boolean {
// Compute expected HMAC SHA-256 hash using shared webhook secret
const expectedSignature = crypto
.createHmac('sha256', secretKey)
.update(rawBody, 'utf8')
.digest('hex');
// Prevent timing attacks using constant-time comparison
const signatureBuffer = Buffer.from(signatureHeader, 'hex');
const expectedBuffer = Buffer.from(expectedSignature, 'hex');
if (signatureBuffer.length !== expectedBuffer.length) {
return false;
}
return crypto.timingSafeEqual(signatureBuffer, expectedBuffer);
}
200 OK Immediately: Webhook providers timeout if an endpoint takes more than 3–5 seconds to respond. Parse the payload, push the job onto a background task queue (e.g., BullMQ, SQS, Celery), and immediately return a 200 response.event.id) in your database with a unique constraint to avoid duplicate billing or duplicate emails.body-parser can reorder JSON keys and invalidate the cryptographic signature.Reputable webhook providers (such as Stripe and GitHub) employ exponential backoff retry schedules. If your endpoint returns a 5xx error or times out, the service will retry sending the event over the next 24 to 72 hours before marking it failed.
Webhooks are server-to-server, stateless HTTP callbacks triggered on discrete events. WebSockets establish a persistent, bidirectional, full-duplex TCP connection between a client browser and a server, ideal for real-time multiplayer games, live chat, or streaming financial tickers.
You can simulate requests, verify headers, and inspect formatted JSON payloads directly inside your browser with our client-side Webhook Tester.
Free, browser-based utilities to test, generate, and inspect Webhooks (HTTP Push Notifications & Reverse APIs) payloads directly.
Generate a unique URL, capture webhook requests, inspect headers & body, and replay them.
Build and test HTTP API requests with headers, body, auth, and response visualization.
Convert cURL commands to code in 12+ programming languages instantly.