Opinion
The Webhook Glue Server You Keep Rewriting
It is always about twenty lines. Receive a POST, check one field, build a different JSON object, send it somewhere. You have written it for Slack, for the CRM, for the deploy hook. The code was never the expensive part.
17 November 2026 · 3 min read
The twenty lines
import express from "express";
const app = express();
app.post("/hooks/deploys", express.json(), async (req, res) => {
res.sendStatus(200);
const event = req.body;
if (event.status !== "failed") return;
await fetch(process.env.SLACK_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `:x: Deploy failed on *${event.project}* (${event.branch})\n${event.url}`,
}),
});
});
app.listen(3000);Nothing is wrong with this code. It took fifteen minutes and it works.
The rest of it
Then it has to exist somewhere, and that is a longer list:
- A host, with a public address and a certificate.
- A deploy path, even if it is one person running one command.
- A place for the secret that is not the repository.
- Logs, for the day someone asks why a message never arrived, and somewhere to keep them.
- Monitoring, because a webhook receiver that is down fails silently. Nobody visits it. The messages simply stop.
- Upkeep. The runtime reaches end of life. The framework ships a security release. The platform retires the plan it runs on.
- Memory. Somebody has to know it exists, where it runs, and that the alert channel depends on it.
Each of those is small. Together they are the reason these services are still running on a forgotten instance three years later, owned by someone who has left.
The serverless version trims the list but does not remove it. A function still needs deploying, secrets, logs and an owner.
The same thing without the service
Look at what those twenty lines actually decide. One condition:
| Field | Operator | Value |
|---|---|---|
body.status | equals | failed |
One reshaping:
{
"text": ":x: Deploy failed on *{{body.project}}* ({{body.branch}})\n{{body.url}}"
}And one destination: the Slack URL. That is an automation, configured on a webhook URL in a couple of minutes. There is nothing to deploy and nothing to patch. And it comes with the parts the twenty lines never had: every incoming request is kept and viewable, every outgoing delivery is logged with its status and the reply, and you can re-send any captured request with one button while you adjust the wording.
When to write the service anyway
A template is not a substitute for code, and pretending otherwise leads to worse systems. Write the service when:
| If the handler has to | Because |
|---|---|
| Change your own data: mark an order paid, provision an account | That is business logic. It belongs in your codebase, with tests |
| Never lose an event | You need a queue and retries. Automation deliveries are at-most-once |
| Refuse forged requests | Signature checks must run in code before anything acts on the payload |
| Calculate, loop or branch in depth | Templates have no arithmetic, loops or nested conditions |
| Call a second system and combine the results | An automation sends one request and does not read the reply |
| Handle sustained high volume | Automations have budgets: up to 10,000 deliveries a day per URL on a pass, 1,000 free |
When not to
Skip the service when the handler only:
- Notifies people. A message in Slack, Discord or Telegram, or a push to a phone.
- Adapts a format. Service A's JSON into the JSON service B accepts.
- Relays. The same webhook to a second environment or a second consumer.
- Triggers. A build, a deploy or a sync that is safe to run twice and tolerable to miss once.
The common thread: if one delivery goes missing, somebody is mildly inconvenienced and nothing is corrupted. That is the honest test.
Both at once
These are not exclusive. A pattern that works well is to register one webhook.stream URL with the provider and attach two automations: one forwards the request unchanged to your real service, signature intact, and one posts a readable line to a channel. Your service keeps the logic that deserves to be code. The notification stops being a feature someone has to maintain inside it.
You also get a recording of everything the provider sent, which is worth having the next time the service and the provider disagree about what happened.
Further reading
- How templates reshape a payload, including what they cannot do
- How conditions decide what gets through
- The same argument, applied to workflow platforms
Retire one of them
Pick the smallest glue service you run. Create a URL, rebuild its one condition and one template, and point the provider at it for a week alongside the original.
Keep reading
A lighter alternative to Zapier for webhooks
If your automation is one step long (a webhook arrives, a request goes out), you do not need a workflow platform. What a lightweight webhook relay does, where it stops, and how to choose.
ReadTransform a webhook payload
Reshape webhook JSON into the payload another API expects using a template: pick fields, keep types, set defaults and format values, with a live preview against a real request.
Read