Adding a diagnostic WhatsApp status endpoint to a Next.js API ( app/api/whatsapp/estado/route.ts )
TL;DR: I added a new admin‑only endpoint ( /api/whatsapp/estado ) that returns the health of our WhatsApp Business API client and automatically subscribes the webhook if needed. The change also fixed a routing conflict that was causing every /api/whatsapp/* request to return 404.
The Problem
Our ticketing platform albaida‑tickets relies on a WhatsApp Business API client to receive voice notes from residents. The client runs in production behind a webhook that forwards incoming messages to our backend.…