Return 200 from webhooks you don't act on
On this page
My feedback tool turns email replies into comments. Resend receives mail for the domain and posts an email.received event to a webhook; the handler finds the ticket id in the recipient address and attaches the reply.
Some mail arrives at addresses that do not belong to any ticket. People write to a plain mailbox on the domain, bounces come back, spam comes in. The handler did the thing that felt correct: return response('No ticket ID found', 400). The payload was fine. We just had nothing to do with it.
After about three weeks of those 400s, Resend auto-disabled the endpoint. No email, no banner I noticed. The domain still showed as verified, the receiving log still showed messages arriving. What I saw was "replies to ticket emails stopped becoming comments", and I spent the first hour looking at parsing code. The endpoint had simply been switched off because, from the provider's side, it had been failing for weeks.
The fix was a two-line diff:
- return response('Ticket not found', 404);
+ return response('Ticket not found', 200);
- return response('No ticket ID found', 400);
+ return response('No ticket ID found', 200);
plus re-enabling the endpoint in the dashboard.
The rule
Status codes on a webhook are a message to the provider's retry and health system, not to a human.
- Signature fails: 401. That really is unauthenticated.
- Required field missing, body is not JSON: 400. That really is malformed.
- Valid event, nothing for you to do: 200, with a warning in the log.
- Your side broke, database down, exception: 500, because you want the retry.
"Received, not for me" is a success from the provider's point of view. They delivered it. The body can still say Ticket not found for anyone reading the dashboard. Only the status code matters to the machine.
Two more things while you are in there
Idempotency. Providers retry, and some events overlap. Stripe can send checkout.session.completed and payment_intent.succeeded for one charge. My billing portal's markPaid checks for the payment intent id before inserting a payment, and my license webhook looks up the Checkout Session id inside a transaction before issuing a key. A handler that is safe to run twice is a handler that is safe to retry.
Default to 200. Cashier's webhook controller returns an empty 200 for any event it has no method for. My own Stripe handler ends its match with default => 'Ignored' and still answers 200. Write that line first, before any of the real cases.
The thing that stuck with me is how quiet the failure was. Nothing errored. A feature stopped working for three weeks and the cause was a status code I had chosen on purpose.