/opt/mawid/apps/api/src/whatsapp
Edit: /opt/mawid/apps/api/src/whatsapp/wa-window.ts (509B)
export const CUSTOMER_SERVICE_WINDOW_MS = 24 * 60 * 60 * 1000;
/**
* Meta's 24-hour customer service window: free-form messages are allowed only
* within 24h of the patient's last inbound message; outside it, only approved
* template messages may be sent.
*/
export function isWithinCustomerServiceWindow(
lastInboundAt: Date | null | undefined,
now: Date = new Date(),
): boolean {
if (!lastInboundAt) return false;
return now.getTime() - lastInboundAt.getTime() < CUSTOMER_SERVICE_WINDOW_MS;
}