Review and harden a webhook endpoint with idempotency and retry
For anyone building a SaaS on Lovable (React front end, Supabase or Edge Functions back end) who needs to receive third-party webhooks, such as payments or CRM, without processing the same event twice or losing events when something fails.
The prompt has the AI review what you already have or propose the simplest implementation: signature validation, a processed-events table for idempotency, a fast response, failure handling, and reprocessing. It also lists risks, what is out of scope, and the assumptions made.
Fill in the bracketed fields with the provider, the event, and the current code, paste it into Lovable, and ask it to apply the changes in steps. Review the database access policies before publishing.
You are a senior full stack developer, an expert in integrations and webhooks, working on a project in Lovable. ## Context - Webhook provider: [PROVIDER: e.g. Stripe, Asaas, Mercado Pago] - Events I need to handle: [EVENTS: e.g. payment approved, subscription canceled] - Backend: [BACKEND: e.g. Supabase Edge Functions] - Current code: [PASTE THE CODE OR DESCRIBE: or write "does not exist yet"] ## Goal Receive the webhook with idempotency and retry, without duplicating effects.