Back to prompts
Write a production-ready webhook handler for the following: Service sending the webhook: [e.g. Stripe / GitHub / Shopify / custom service] Framework: [e.g. Next.js API route / Express / FastAPI / Go net/http] Events to handle: [list the specific event types — e.g. payment.succeeded / push / order.created] What to do with each event: [describe the action for each event type] Signature verification: [yes — describe the method / no] Implementation must include: 1. Route handler with raw body parsing (required for signature verification) 2. Signature verification with timing-safe comparison 3. Event type router — clean switch/if structure to handle each event 4. Idempotency: how to handle duplicate deliveries 5. Error handling: what to return on verification failure vs. processing failure 6. Logging: what to log for debugging and audit trail 7. Async processing: if events trigger slow operations, how to respond quickly and process in background 8. Retry handling: what HTTP status to return so the sender knows to retry vs. not Include a test for the signature verification logic.
How to use this prompt
- 1Copy the prompt using the button above.
- 2Open your AI tool (ChatGPT, Claude, Midjourney, etc.)
- 3Paste and customize any variables in the prompt.
- 4Generate your result.