Fallback bridge replies by phone

This commit is contained in:
Tiago
2026-09-29 17:04:26 -03:00
parent 2d2b55128a
commit 3e9ee4db53
@@ -119,8 +119,8 @@ public final class ExternalBridgeHandler implements HttpHandler {
}
try (Connection c = masterDs.getMasterConnection()) {
Map<String,Object> envio = one(c, "SELECT * FROM integracao_mensagens WHERE telefone=? AND callback_url IS NOT NULL AND status='enviado' ORDER BY criado_em DESC,id DESC LIMIT 1", numero);
if (envio == null && raw.contains("@lid")) {
envio = one(c, "SELECT * FROM integracao_mensagens WHERE callback_url IS NOT NULL AND status='enviado' AND criado_em >= now() - interval '24 hours' ORDER BY criado_em DESC,id DESC LIMIT 1");
if (envio == null) {
envio = one(c, "SELECT * FROM integracao_mensagens WHERE telefone=? AND callback_url IS NOT NULL AND criado_em >= now() - interval '24 hours' ORDER BY criado_em DESC,id DESC LIMIT 1", numero);
}
if (envio == null) {
System.out.println("Webhook Evolution sem envio correspondente. numero=" + numero + ", texto=" + resumo(texto));