A webhook sits at the boundary between an external producer and your own workflow. A payment event can release an order, while a ticket update can notify a customer. The receiver should account for unsolicited requests and legitimate events the producer delivers more than once.
Verify before accepting work
Follow the producer's documented signature scheme and use the unmodified request body if the scheme signs those bytes. Use a safe comparison function or the vendor's supported library. Check timestamps and clock tolerance where supported, and scope each signing secret to its intended endpoint and environment. Plan secret rotation so the receiver and producer agree on the active key. Keep malformed or unverified traffic out of the processing queue.
Give delivered events a durable identity
Store the producer's event or delivery identifier under the right account or endpoint. A uniqueness constraint lets concurrent deliveries converge on the same receipt. Define the response after durable acceptance, and track processing state separately. If emitting a customer notification and updating a local record are distinct operations, arrange retries so a failure in one step can be recovered without repeating work already completed.
Make the behavior visible
Log event type, delivery identifier, processing state and verification outcome without logging secrets or sensitive payloads. In a controlled environment, check an ordinary successful delivery, a repeat and a downstream timeout. Decide how authorized staff can replay or reconcile a valid event. The dashboard should distinguish an event accepted by the receiver from a business action that finished. Keep the deduplication window long enough for the producer's documented retry policy and any longer period during which support can replay the same event.