How do you test webhooks and asynchronous API operations?
- webhooks
- async operations
- event-driven
Answer it first, then compare. Nothing here is saved or scored.
Model answer
For webhooks: set up a test endpoint (using tools like webhook.site or a local server) to receive webhook payloads. Trigger the event, then poll your endpoint to verify the webhook arrived with the correct payload, headers, and timing. For async operations: call the initiating endpoint, then poll the status endpoint until completion (with timeout). Verify the final state and any side effects. Test retry behavior for failed webhook deliveries.
What interviewers listen for
- Schema-first thinkingYou validate response shape before you assert on values, every time.
- Status-code literacyYou can defend why 401 vs 403 vs 422 matters for the consumer.
- Contract awarenessYou know when consumer-driven contract tests beat end-to-end checks.
- Auth fluencyYou can describe rotating tokens across parallel workers without secrets in logs.