wakit
Messages

Message status

Track message delivery status from sent to read.

Every outgoing message goes through a lifecycle of status updates. wakit tracks these automatically via WhatsApp webhooks.

Status flow

pending → sent → delivered → read
                           → failed

Status fields

The status column on the messages table is a JSON object with timestamps:

{
  "pending": "2026-05-06T03:39:23+00:00",
  "sent": "2026-05-06T03:39:24+00:00",
  "delivered": "2026-05-06T03:39:25+00:00",
  "read": "2026-05-06T03:39:30+00:00"
}
StatusMeaning
pendingMessage inserted in database, not yet sent
sentWhatsApp Cloud API accepted the message
deliveredMessage delivered to the recipient's device
readRecipient opened/read the message
failedMessage could not be sent (includes error details)

Failed messages

When a message fails, the status object includes a failed timestamp and an errors array with details from Meta:

{
  "pending": "2026-05-06T03:39:23+00:00",
  "failed": "2026-05-06T03:39:24+00:00",
  "errors": [
    {
      "error": {
        "code": 131042,
        "type": "OAuthException",
        "message": "(#131042) Business eligibility payment issue",
        "error_data": {
          "details": "Payment method is not set up or has been removed",
          "messaging_product": "whatsapp"
        },
        "fbtrace_id": "A1NdQYqM-yB..."
      }
    }
  ]
}

Common error codes

CodeNameDescription
100Invalid parameterMissing or malformed parameter (e.g. template variable)
131042Payment issueBusiness hasn't set up or has removed their payment method
131047Re-engagementTrying to send a free-form message outside the 24h service window
131051Unsupported message typeThe message type is not supported for this recipient
130429Rate limitToo many messages sent — throughput limit reached
132000Template params mismatchNumber of template variables doesn't match the template
132001Template not foundTemplate name doesn't exist in the specified language
132015Template pausedTemplate has been paused by Meta
133004Server unavailableMeta servers temporarily unavailable
368Account restrictedAccount temporarily banned for policy violations
80007WABA rate limitWhatsApp Business Account rate limit reached

For the full list, see the Meta WhatsApp Cloud API error codes reference.

Query by status

Messages that failed to send:

const { data } = await supabase
  .from('messages')
  .select('*')
  .eq('direction', 'outgoing')
  .not('status->failed', 'is', null);

Unread outgoing messages:

const { data } = await supabase
  .from('messages')
  .select('*')
  .eq('direction', 'outgoing')
  .is('status->read', null)
  .not('status->delivered', 'is', null);

Real-time status updates

supabase
  .channel('status')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'messages',
      filter: `organization_id=eq.${orgId}`,
    },
    (payload) => {
      console.log('Status update:', payload.new.status);
    }
  )
  .subscribe();

Webhooks

Configure a webhook for messages / update to get notified on your server when status changes. See Webhooks.

On this page