Every outgoing WhatsApp message produces a few status webhooks: sent , delivered , read , or failed . If you store whichever one arrived last, your data goes wrong in ways that are hard to spot: a "read" message drops back to "delivered", a failure is overwritten by a late "sent", or a status arrives for a message you haven't saved yet and is lost. Treat delivery as a state that only moves forward, keep each status's timestamp separately, accept that delivered is sometimes never sent, and hold statuses that arrive before the message row exists.
The snippets are small, self-contained versions of the patterns, and each was run against the cases shown.
What Meta sends, and what it doesn't promise
Meta's status webhook reference defines the statuses:
sent: "the message was successfully sent from our servers."
delivered: "message was successfully delivered to the WhatsApp user's device."
read: "the message was displayed in an open chat thread in the WhatsApp user's device."
failed: "failure to send or…