fix(webhook): replace return Response with return in processMetaMessage — root cause of coach photos being treated as food scans

This commit is contained in:
marciobever 2026-04-22 15:45:26 -03:00
parent 8502a82b5a
commit f85a4a3300

View file

@ -888,7 +888,7 @@ RETORNE estritamente 3 bullet points recomendando o que o paciente pode adiciona
"📸 *ENVIE SUA FOTO*\n\nTire uma selfie no espelho ou foto de frente do seu corpo.\n\n✅ Boa iluminação\n✅ Sem camisa (homens) ou de Top/Regata (mulheres)\n✅ Mostrando do pescoço até a cintura/joelhos" "📸 *ENVIE SUA FOTO*\n\nTire uma selfie no espelho ou foto de frente do seu corpo.\n\n✅ Boa iluminação\n✅ Sem camisa (homens) ou de Top/Regata (mulheres)\n✅ Mostrando do pescoço até a cintura/joelhos"
); );
}, 0); }, 0);
return new Response("Coach Started", { status: 200 }); return;
} }
// COACH_FRONT // COACH_FRONT
@ -897,7 +897,7 @@ RETORNE estritamente 3 bullet points recomendando o que o paciente pode adiciona
setTimeout(async () => { setTimeout(async () => {
await sendWhatsAppMessage(remoteJid, "⚠️ Por favor, envie a foto de *FRENTE* para continuarmos."); await sendWhatsAppMessage(remoteJid, "⚠️ Por favor, envie a foto de *FRENTE* para continuarmos.");
}, 0); }, 0);
return new Response("Waiting for image", { status: 200 }); return;
} }
// Offload long-running task to background // Offload long-running task to background
@ -928,7 +928,7 @@ RETORNE estritamente 3 bullet points recomendando o que o paciente pode adiciona
] ]
); );
}, 0); }, 0);
return new Response("Coach Photo image received", { status: 200 }); return;
} }
// COACH_GOAL // COACH_GOAL
@ -1104,7 +1104,7 @@ RETORNE estritamente 3 bullet points recomendando o que o paciente pode adiciona
.eq("phone_number", senderNumber); .eq("phone_number", senderNumber);
} }
}, 0); }, 0);
return new Response("Coach Workflow Completed", { status: 200 }); return;
} }
// ── 6. Food Scan Flow (IDLE) ──────────────────────────────── // ── 6. Food Scan Flow (IDLE) ────────────────────────────────
@ -1414,7 +1414,7 @@ RETORNE estritamente 3 bullet points recomendando o que o paciente pode adiciona
} }
}, 0); }, 0);
return new Response("Food Scan Started", { status: 200 }); return;
} }
} catch (criticalErr) { // Capture da função async flutuante } catch (criticalErr) { // Capture da função async flutuante