Tutorial5 min read

Guide: Building Reliable Webhook Delivery in 5 Minutes

Stop losing webhooks to timeouts and server restarts.

Webhooks are the glue of the modern web, but they are notoriously unreliable. If your server is down for a split second during a deployment, or if a request takes slightly too long and times out, you lose that data forever.

In this guide, we'll show you how to use FetchAPI to build a bulletproof webhook delivery system in just 5 minutes.

Step 1: Sign Up and Get Your API Key

First, head over to FetchAPI and create a free account. Once you're in, grab your secret API key from the dashboard. It will look something like relay_sk_....

Step 2: Relay Your Webhook

Instead of sending your webhook directly to your destination server, you'll send it to FetchAPI first. We act as a durable buffer.

Use the X-Fetch-Url header to specify where the webhook should eventually go.

Example: cURL

curl -X POST https://api.fetchapi.dev/v1/fetch \
  -H "Authorization: Bearer relay_sk_your_key" \
  -H "X-Fetch-Url: https://your-backend.com/webhooks/stripe" \
  -H "Content-Type: application/json" \
  -d '{"id": "evt_123", "type": "charge.succeeded"}'

Step 3: Automatic Retries

This is where the magic happens. If your-backend.com is down, FetchAPI won't just give up. We will automatically retry the delivery using exponential backoff.

You don't need to write any retry logic. You don't need a database to track failed attempts. We handle all of it.

Step 4: Check Delivery Status

You can monitor the status of every webhook delivery in the FetchAPI dashboard.

[Dashboard Screenshot Description: A clean, real-time table showing a list of relayed requests. Each row shows the status (Success, Retrying, Failed), the destination URL, the number of attempts, and the last response code.]

Step 5: Handle Callbacks (Optional)

If you need your source system to know when the delivery finally succeeds (or if it fails after all retries), you can use the X-Callback-Url header. We'll send a POST request to that URL with the final result.

Example: JavaScript SDK-like usage

const relayWebhook = async (payload) => {
  const res = await fetch('https://api.fetchapi.dev/v1/fetch', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.FETCHAPI_KEY}`,
      'X-Fetch-Url': 'https://api.myapp.com/webhooks/receiver',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(payload)
  });
  
  return res.json();
};

Conclusion

By adding FetchAPI as a relay, you've turned a fragile webhook integration into a durable, reliable system. You've gained observability, automatic retries, and peace of mind—all in under 5 minutes.

Ready to build?

Start relaying your webhooks today and never miss a delivery again.

Get Started Free