Skip to content
← Back to blog

Letting an Agent Register and Test Your Webhooks

7 min read
webhooksintegrationsguide

You register the endpoint at 10:14 and go back to work. At 11:40 a real ticket arrives, your handler throws on a field you assumed was always present, and the delivery is recorded as a 500 that nobody looks at. At 2:20 the next ticket does the same thing. You find out at six, when you notice the Slack channel has been quiet all day.

Nothing in that story is a hard bug. It is a five-minute fix wrapped in eight hours of latency, and the latency is the actual problem. Webhook setup is a loop — register, wait, discover the handler threw, fix, wait again — and its slowest step is waiting for reality to produce an event you can learn something from.

The usual workarounds are fine and slightly miserable. You hold a tunnel open to localhost and create test tickets by hand. You curl a payload from the docs at yourself, which exercises your parsing but not the delivery path, the headers, or the signature. You ship and check the deliveries page tomorrow. Each narrows the loop without closing it.

This post is about closing it: register an endpoint, fire a synthetic event at it in the same breath, read back what your server answered, fix, and go round again in seconds. And about why this is one of the very few things in a support stack you can hand to a coding agent and let it grind on unattended. Whether you want webhooks at all is a different argument, and webhooks vs polling already has it out.

The loop, and its slowest step

Write out what happens the first time you wire up an endpoint. Register the URL and pick the events. Wait for something real to happen. Find out — somehow — whether your handler survived it. Fix whatever it was, and go back to waiting.

The registering and the fixing are quick. The waiting is unbounded. And the finding out is the step people underestimate, because somehow is doing an enormous amount of work in that sentence. Your server logged something, maybe. The platform recorded a delivery, probably. Neither is in front of you when you need it.

What you want there is one answer to one question: when the platform POSTed to your URL, what came back? Not what your own logs believe happened — what the sender saw. The status it got, the body your framework returned, how long it waited. That is what separates a 500 from a 404 from a DNS failure from a five-second timeout. Four unrelated bugs that all present as "it isn't working."

Fire the event yourself

The fix for an unbounded wait is to stop waiting. A test delivery is a real POST to your real URL over the real transport, with the real headers and the real signature. Only the payload is synthetic, and it says so.

The one Helmdesk sends is a ticket.created body with ticket number 0, an all-zero id and data.test: true — enough that a handler which would otherwise write to your database can be taught to bail out on the flag. It goes out regardless of whether the endpoint is active or subscribed to that event, because the point is to test the wire, not the routing. And the call waits for your server before answering you:

{
  "success": true,
  "responseStatus": 200,
  "responseBody": "ok",
  "durationMs": 184,
  "deliveryId": "…",
  "event": "ticket.created"
}

The field people skip is the one that matters. responseStatus is null when nothing answered at all — a timeout, a refused connection, a hostname that does not resolve — and then responseBody carries the transport error instead. A failure with a null status means your URL is wrong or your box is down; a failure with a 500 means your URL is right and your code is broken. Different afternoon entirely.

The delivery history is the same question asked backwards. Every attempt is recorded — event, success flag, HTTP status, response body, timestamp — newest first, filterable to failures only. Test deliveries land there alongside real ones, which is the detail that makes this work: fire three tests, list the failures, read the three error bodies your handler produced, without leaving the terminal.

Why this is safe to let an agent iterate on

Most of a support platform's write surface reaches a human being. Replying to a ticket sends an email. Resolving one sends a satisfaction survey. Ten tools in Helmdesk's MCP server are outbound in that sense, and nothing should loop on them unsupervised, because the undo button is an apology.

A webhook test is the opposite. It reaches your endpoint, on your infrastructure, with a payload nobody outside your firewall will ever see. Nothing is emailed. No customer is touched. The worst case is a row in your own delivery log. That makes it one of the few genuinely safe agent loops in this domain — the kind where "try it, read the error, change the code, try again" is the right instruction.

The loop looks like this:

  • Register the endpoint with the events you actually handle, and put the returned secret in the environment.
  • Fire a test and read the status, body and duration back.
  • Edit the handler based on that body — an unhandled TypeError in the response text is a stack trace you did not have to go find.
  • Fire again, until the status is 200 and the duration is under a second.
  • List the deliveries filtered to failures, confirming nothing earlier is still red.

Four or five round trips, each a couple of hundred milliseconds, all against production plumbing and none of it visible to a customer. That is the loop that used to take a day.

Be honest about what a green test does not prove. It proves one ticket.created payload reached one URL and got a 2xx. It says nothing about whether your email.bounced branch parses, whether your handler is idempotent when the same event arrives twice, or whether it holds under the five-second timeout when the database is busy. It cannot reach localhost either.

The secret is shown once, and only once

The signing secret — the whsec_ string you verify HMACs against — comes back in the create response and never again. Not in the list, not in an update response, not in the dashboard afterwards. If an agent registers the endpoint for you, that secret exists in exactly one tool result, and it needs to reach your environment before you move on.

Which means there is no rotate. You can change an endpoint's URL, its events, its Slack formatting and its active flag without disturbing the secret. You cannot change the secret. Deleting the endpoint and recreating it issues a new one — fine as a deliberate rotation, quietly catastrophic as an accident, because your handler keeps computing HMACs with the old value and rejects every delivery with a 401 while looking perfectly healthy.

So while you are iterating, pause the endpoint instead of recreating it: setting it inactive stops deliveries and keeps the secret. Recreate only when you mean to rotate, and update the environment variable in the same commit.

The bottom line

Webhook setup feels harder than it is for a reason that has nothing to do with HMACs or retries. The feedback cycle runs at the speed of your customers, and your customers are not on call for your integration work. Everything worth doing here takes that dependency out: send the event yourself, read what your server actually said rather than what your logs guess it said, check the delivery history before declaring victory. That is fair to demand of any platform — if you cannot fire an event at your own endpoint and see the answer, you are debugging by waiting.

Do that and the endpoint that used to reveal its bug at six in the evening reveals it at 10:15, forty seconds after you registered it. Same bug, same fix. The difference is that at 10:15 you are still holding the file.

Register it, test it, read the answer

Per-project webhooks with HMAC signatures, a synthetic test delivery that reports exactly what your endpoint returned, and a full delivery log — over the API, the SDK, or MCP.