Minimal Interoperability Mechanisms for Smart Cities
City departments and suppliers often run separate systems for transport, buildings, environmental monitoring, and other services. When those systems are interoperable, they…
When an event happens, such as a payment succeeding or an order changing, one service sends an HTTP request called a webhook to another service. You need to test more than whether your receiver returns a success code once. Your receiver has to verify who sent the request, save it safely, handle repeat deliveries, and recover when a request fails or arrives late.
Start with the sender’s documented delivery rules to set your expectations, then test how your receiver handles failures. That way you can see whether your integration handles retries, duplicate events, timeouts, and outages without losing events or repeating business actions.
Before you write any tests, read the provider’s documentation. Look for what counts as a successful response, how long your server has to reply, and how the provider retries failed deliveries. Also check how it identifies events, whether it guarantees ordering, and how you can redeliver missed events.
Those details vary a lot. GitHub, for example, asks receivers to return a 2XX status within 10 seconds. Shopify’s HTTPS guidance sets a one-second connection timeout and a five-second timeout for the full request, and Shopify treats any response outside the 200 range, including redirects, as an error. Those are provider-specific rules, rather than universal defaults. You can check GitHub’s webhook guidance and Shopify’s delivery verification guidance for the full details.
Write down the rules for each provider and endpoint so you know what response times, retry outcomes, and recovery steps to expect. If a provider does not document ordering or replay behavior, check what its dashboard or API exposes instead of assuming a guarantee. Clear delivery terms also keep your tests aligned with your integration’s webhook contract.
Send a valid test event through the exact same endpoint code that handles live traffic. Check that your receiver reads the expected HTTP method, headers, and body, and that it recognizes the event type. It should verify the request and record the event before it returns a success status.
A webhook signature is a cryptographic value the sender attaches so your receiver can confirm the request came from the right source and that nobody altered its contents. Follow the provider’s signing rules closely. GitHub signs the payload with your webhook secret, while Shopify’s HTTPS method calculates an HMAC from the raw request body. If your receiver parses the JSON and reserializes it before checking the signature, the changed bytes will make verification fail. GitHub lays out its steps in its signature verification procedure.
Test four cases: a valid signature, a wrong secret, a modified body, and a missing signature. Your receiver should reject any invalid request before it triggers business logic. If the provider includes a timestamp in the signature, test its documented freshness window too. Keep in mind that a valid signature only proves authenticity. It does not stop a valid request from arriving more than once.
Your receiver should acknowledge an event only after it saves the event safely. A common approach is to write the event to a durable queue or database and return a success status right away, while a background worker handles the slower business tasks. If that database or queue write fails, your receiver should return an error instead of acknowledging an event it never saved. That approach lets your receiver meet tight response deadlines without losing events.
A sender may retry a request after a timeout or a lost response, even if your receiver already finished the work. Build and test for repeat deliveries by sending the same event twice in a row, then sending two copies at the exact same time. Confirm that your receiver acknowledges the repeat without running the business action a second time.
Use a stable ID from the provider to spot duplicates, as long as that ID matches what you consider the same event. A database constraint that allows only one row per ID stops two simultaneous requests from both passing a separate “already seen?” check. Providers define their IDs differently, though. Shopify, for example, distinguishes an ID for an individual delivery from an event ID that links deliveries caused by the same merchant action. Check the provider’s definitions before you pick a key. Idempotency and deduplication explains the design principles behind making repeat requests safe.
Test partial failures as well. Force your receiver to save an event and then fail partway through, such as while sending a notification. Deliver the event again and confirm that your receiver finishes the missed step without repeating the work it already completed. Track whether each downstream action finished, because deduplicating the incoming request alone does not guarantee that every later step is safe to repeat.
Configure a test endpoint to fail in four ways: return a server error, return a redirect, delay its response past the timeout, and close the connection without replying. For each case, watch whether the provider retries, check how the delivery shows up in your logs, and verify that your receiver processes the event once it recovers. Compare what happens against the provider’s documented policy.
Retry schedules vary widely from one provider to another. Shopify documents eight retries over four hours for its HTTPS webhooks, while Svix publishes a different schedule for its own service. Test against your sender’s actual policy instead of assuming another provider’s attempt count or retry window. The Svix retry guidance shows how much retry timing can differ.
Next, simulate an outage that lasts long enough to exhaust the provider’s automatic retries, then bring the endpoint back online. Check how an operator can recover the missed events, whether through manual redelivery, a replay feature, or a reconciliation job that pulls current records from the provider’s API. Shopify recommends reconciliation because webhooks can still be missed or mishandled, and GitHub documents manual redelivery for missed events. Check your provider’s retention limits and recovery tools, because automatic retries alone do not guarantee that every event will arrive.
Do not assume that events will arrive in the order they happened. Shopify explicitly notes that it does not guarantee ordering within a topic or across topics for the same resource. Test this by sending a newer update before an older one. If your receiver would overwrite newer state by applying the older event, use the provider’s documented sequence or version fields when they exist, or fetch the resource’s current state from the API before you update it.
Finally, send a burst of events and duplicate events at the same time. Check that your receiver still replies within the provider’s deadline, that its queue does not grow without limit, and that workers do not apply conflicting updates. Tools like the Stripe CLI let you forward and resend Stripe events during local development, though a local run does not replace testing in a staging environment with your production provider settings.
Use delivery logs and metrics to pinpoint where an event failed and confirm that recovery worked. Track how often deliveries succeed on the first try, how often they succeed within the retry window, and how many exhaust all retries. You should also watch response latency, duplicate rates, queue delay, and recovery time. Report these numbers separately for each endpoint so strong results at healthy destinations do not hide a failing one. Webhook monitoring guidance covers these delivery signals in more detail.
A practical test plan should include:
| Scenario | What to verify |
|---|---|
| Valid event | The receiver authenticates the request and records the expected event. |
| Invalid or altered request | The receiver rejects it before any business action runs. |
| Duplicate, including concurrent copies | The receiver runs the business action once and safely acknowledges the repeats. |
| Partial processing failure | A later attempt finishes the missed work without repeating completed actions. |
| Timeout, error response, or connection loss | The provider’s retry behavior matches its documented rules. |
| Out-of-order events | Older data does not overwrite newer state. |
| Extended outage | Operators can spot missed events and recover them using the provider’s tools or reconciliation. |
| Event burst | Response times, queue growth, and concurrent processing stay within safe limits. |
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com