How webhooks work and when to use them

TL;DR – Executive summary

Webhook is a "reverse API": instead of constantly querying the data, the system will notify you when something happens. Example: an online store sends a webhook when an order comes in, and the stock system responds immediately. Webhooks are faster and more powerful than polling (the poll loop).

Webhook vs Polling vs API

Kill How it works Pros Cons
Webhook Source sends data when an event occurs Real-time, effective Requires endpoint, error handling
Polling You ask for data at regular intervals Easy to implement Delay, load both
API Call Retrieve data if needed Flexible, Managed Not real-time

How does webhook work in practice?

  1. You register the URL: You tell the source system at which address it sends the data
  2. Event Happens: E.g. new order, updated customer, invoice sent
  3. The source system sends an HTTP POST request: JSON format data to your URL
  4. Your system processes the data: Record, forward, take action
  5. You return the answer: 200 OK = received, other = try again

Examples of webhook use

  • E-commerce → warehouse: New Order Triggers Stock Update
  • Form → CRM: Contact goes directly to Pipedrive/HubSpot
  • Payment → Accounting: Stripe payment triggers accounting entry
  • Calendar Reservation → SMS: Confirmation of booking via SMS
  • GitHub → Slack: Code will be pressed → Announcement to Team Channel

Receiving Webhook (endpoint)

You need a server that receives HTTP POST requests. A simple example with Node.js:

// Express.js example
app.post('/webhook/order', (req, res) => {
  const order = req.body;

  // Process the order
  console.log('New order:', order.id);

  // Return 200 OK
  res.status(200).send('OK');
});

Webhookie Security

Anyone can submit a POST request to your URL. Make sure the request comes from the correct source:

  • Signature check: Many services send HMAC signature in header. Count for yourself and compare.
  • Secret token in URL: /webhook/abc123secret – difficult to guess, but not the best practice
  • IP Restriction: Allow only certain IP addresses (if the service documents them)
  • HTTPS: Always. Never receive webhook with HTTP.

Error Handling and Retry

What happens when the endpoint doesn't respond?

  • Most services will try (retry) a few times
  • Typical retry model: immediately, 5 min, 30 min, 2 h, 24 h
  • If all fails, the webhook will be marked as failed and must be handled manually
  • Recommendation: Reply immediately 200 OK and deal in the background (queue) – This is not timeout

Testing Webhookie

  • webhook.site: A free tool that shows the webhooks received
  • ngrok: Reveals a localhost server on the internet for testing
  • Postman: Send test requests manually
  • Service Test Tool: Many services (Stripe, Shopify) offer the "Send test webhook" function

Common errors in webhooks

  1. No signature check: Anyone can send fake requests.
  2. Too slow processing: If processing takes >30s, timeout → retry → Duplicates.
  3. No Idempotence: The same webhook can come many times (retry). Handle only once.
  4. No logging: When something goes wrong, you don't know what happened.
  5. HTTP without S: Data travels unencrypted.

Frequently asked questions

Can a webhook be made without coding?

Yes. Zapier, Make (Integromat) and n8n receive webhooks and perform procedures without coding.

How do I know what data the webhook is sending?

Read the API documentation for the service. You can also use webhook.site to see what's really coming.

What if I lose webhooks?

Make a backup mechanism: first save the webhooks to the queue/database, then deal. This allows you to re-process if something goes wrong.

Read also

Need help with webhook integration?

We implement webhook-based integrations turnkey. Tell me what you want to automate.

Request an estimate

What would you like to improve in your business?

Datastorm Oy's ERP delivery is a written agreement, ready-to-use system from design to commissioning. The initial discussion and the offer are free of charge; any separate specification work will be agreed in advance. Maintenance and subsequent further development will be agreed separately. Explore our ERP service.

Learn about the content of the related service and Tell us about your business need.