Debugging webhooks with evidence: why I built Sonar
DEV Community

Debugging webhooks with evidence: why I built Sonar

Webhooks are easy to integrate when everything works. Debugging them when something goes wrong is another matter.

A request can arrive with unexpected headers, a different payload structure or an incorrect HTTP method. Without visibility into the actual request, it is easy to waste time debugging the wrong component.

That is why I built Sonar, an open-source tool for inspecting HTTP webhook requests.

Practical workflow

The practical workflow is straightforward:

  • Capture the incoming request.
  • Inspect the headers and payload.
  • Compare what was received with what the integration expects.
  • Use the evidence to narrow down the problem.

A small debugging tool can make a disproportionate difference when connecting services, automating workflows or developing APIs.

The broader lesson: observability should begin at the integration boundary, not only after a failure reaches your application.

Inspect the boundary before debugging the application

Imagine an integration expects JSON but receives a form-encoded request. A parser error downstream tells you what failed, not necessarily why.

Capturing the method, Content-Type, headers and raw body at the boundary lets you compare the sender's contract with the receiver's assumptions.

A reproducible debugging workflow

Use a non-production test payload, remove credentials from captured logs and change one variable at a time.

For example, send an intentionally harmless JSON payload to an endpoint you control:

curl -i -X POST "$TEST_WEBHOOK_URL" \
  -H 'Content-Type: application/json' \
  -d '{"event":"test","id":42}'

Check the status and captured request before changing application code. Never send real tokens or private customer payloads to an untrusted inspector.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.