Skip to main content

Build an idempotent webhook receiver with HMAC verification

Verify webhook signatures safely, prevent replay attacks, deduplicate event IDs, and return 200 fast.

Official Reference

Model Answer & Explanation

Read raw request.body() bytes before JSON parsing, check the timestamp header is within a 5-minute window, compute HMAC-SHA256 and compare with hmac.compare_digest (constant-time), insert event_id into an idempotency table with ON CONFLICT DO NOTHING, and enqueue heavy work before returning 202/200.

Follow-up Interview Question · Why must you verify HMAC over the raw request bytes rather than re-serialized JSON?

Module Context & References

Python & FastAPI · Practice questions & drills High-frequency coding, FastAPI, concurrency and testing exercises
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.