← Back to Webhook Academy

What is a Webhook?

A complete, beginner-friendly guide to webhooks — how they work, why they matter, and how to use them securely.

ELI5 (Explain Like I'm 5): Imagine you order a pizza. Instead of calling the restaurant every 30 seconds to ask "is it ready yet?", they call you when it's done. A webhook works the same way — instead of your app constantly checking for new data, the other service sends it to you the moment something happens.

How Webhooks Work

A webhook is an HTTP callback: when an event occurs in a source application (like a payment succeeding in Stripe), it sends an HTTP POST request to a URL you've configured. Your application receives the request, processes the data, and responds with a 200 OK.

Source
Stripe / GitHub
Event occurs
HTTP POST
JSON payload
Delivered to
Your App
https://you.com/hook

Here's what a typical webhook payload looks like (Stripe payment example):

{
  "type": "payment_intent.succeeded",
  "data": {
    "object": {
      "id": "pi_3abc123",
      "amount": 2000,
      "currency": "usd",
      "status": "succeeded"
    }
  }
}

Webhook vs API Polling

The traditional alternative to webhooks is polling — your app repeatedly calls an API to check for updates. Here's how they compare:

AspectWebhook (push)API Polling (pull)
Data deliveryInstant, real-timeDelayed (depends on poll interval)
Server loadMinimal — only fires on eventsHigh — constant requests even when idle
API rate limitsNot consumedConsumed on every poll
ImplementationRequires a public endpointSimple GET requests
ReliabilityNeeds retry logic for failuresClient controls retry
Cost at scalePays only for real eventsPays for every empty poll

Bottom line: Webhooks are almost always the better choice for real-time, event-driven integrations. Polling is simpler to set up but wasteful and slow.

Common Webhook Use Cases

Payments (Stripe, PayPal, Square)

Get notified instantly when a payment succeeds, fails, disputes, or refunds. Update your database and trigger fulfillment without delay.

CI/CD Pipelines (GitHub, GitLab, Bitbucket)

Trigger builds, tests, and deployments automatically when code is pushed, a PR is merged, or a release is tagged.

E-commerce (Shopify, WooCommerce)

Sync orders, inventory, and customer data in real time. Automate shipping notifications and warehouse fulfillment.

Messaging & Notifications (Slack, Twilio, SendGrid)

React to incoming messages, delivery confirmations, bounces, and status changes as they happen.

SaaS Integrations (Salesforce, HubSpot, Jira)

Keep data synchronized across tools. Update your CRM when a support ticket closes, or notify a channel when a deal moves stages.

Webhook Security Best Practices

Webhooks involve accepting HTTP requests from external sources, so security is critical. Here are the essentials:

1. Verify Signatures

Most providers (Stripe, GitHub, Shopify) sign webhook payloads with HMAC-SHA256. Always verify the signature before processing. This prevents spoofed requests.

2. Enforce HTTPS

Never accept webhooks over plain HTTP. TLS encrypts the payload in transit and prevents man-in-the-middle attacks.

3. Validate Timestamps

Check that the webhook timestamp is recent (within 5 minutes). This prevents replay attacks where an attacker re-sends a captured request.

4. Use IP Allowlisting

Restrict your webhook endpoint to accept requests only from your provider's published IP ranges. Block everything else.

5. Respond Quickly, Process Async

Return a 200 OK immediately and process the webhook asynchronously in a background job. This prevents timeouts and retry storms.

Review your endpoint against the manual webhook security checklist, including signature validation, replay protection, TLS, rate limits, and log redaction.

For a deeper dive into webhook security threats and defenses, read our Webhook Security Best Practices guide.

How to Test Webhooks

During development, you need a way to receive webhooks on your local machine. Here's a quick approach:

  1. Get a temporary URL — use the SDNBros Webhook Tester to get a public endpoint in one click.
  2. Configure the provider — paste your temporary URL into your provider's webhook settings (Stripe Dashboard, GitHub repo settings, etc.).
  3. Trigger an event — make a test payment, push a commit, or use the provider's "send test webhook" button.
  4. Inspect the payload — see the full HTTP request (headers, body, timing) in your tester dashboard.

Test a webhook

Get a free endpoint URL instantly. No signup required. See every header and byte that arrives.

Open Webhook Tester Review Security Checklist

Related guides: Webhook vs API · Webhook Security · Retry Strategies

More: Webhook Security Guide | All Features | Stripe Webhook Guide | Compare Tools

Start catching webhooksTry Free →