Carry over pre-existing WABA outreach automation WIP

This work already existed uncommitted in the main working tree (not
authored by this branch) and is required as a runtime dependency for the
campaign outreach port (zpro-client, templates, outreach routes/UI). Copied
in as-is, untouched, so this feature branch has a working baseline; the
original uncommitted state in the main checkout is left exactly as it was.
This commit is contained in:
Gustavo
2026-08-01 10:12:25 -03:00
parent 0894ab68b3
commit 4f736562f3
33 changed files with 3537 additions and 342 deletions
+24
View File
@@ -0,0 +1,24 @@
import { loadDotEnv } from '../src/env.mjs';
import { openDb, ensureSeeds } from '../src/db.mjs';
import { runOutreachBatch } from '../src/outreach/run.mjs';
// Dispara um lote manual da automacao de envio WhatsApp (Z-PRO), fora do
// ciclo automatico de 20 min do servidor. Util pra testar ou forcar um lote
// extra sem reiniciar o servidor:
// node scripts/enviar-outreach.mjs (ou npm run outreach)
//
// Respeita as mesmas regras do ciclo automatico (outreach.ativo, horario
// comercial, limite diario) — nao manda nada "escondido" do que a tela
// de Configuracoes mostra.
await loadDotEnv();
const log = (message) => console.log(`[outreach] ${message}`);
const db = openDb();
await ensureSeeds(db, { log });
const resumo = await runOutreachBatch({ db, log });
console.log(JSON.stringify(resumo, null, 2));
db.close();