From 9874eb43458d4e8b982ba3b0d43f04b34a2aae2f Mon Sep 17 00:00:00 2001 From: VPS 4 Builder Date: Sun, 28 Jun 2026 18:57:30 +0200 Subject: [PATCH] =?UTF-8?q?docs(newwhats):=20ponte=20de=20config=20conclu?= =?UTF-8?q?=C3=ADda=20(DB-backed=20+=20UI=20dropdown=20+=20testar)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- backend/newwhats/INTEGRACAO-MOTOR.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/newwhats/INTEGRACAO-MOTOR.md b/backend/newwhats/INTEGRACAO-MOTOR.md index f0d5d09..be547ea 100644 --- a/backend/newwhats/INTEGRACAO-MOTOR.md +++ b/backend/newwhats/INTEGRACAO-MOTOR.md @@ -55,9 +55,12 @@ ## Pendências / TODO - [ ] **Segurança**: gatear o proxy `/api/nw/v1/*` com a auth do scoreodonto (hoje aberto — qualquer um que alcance a rota é proxiado ao motor). -- [ ] **Ponte de config**: a config do plugin no frontend é localStorage e **não - chega ao backend** (que lê ENV). Definir: backend ler de `settings`/DB + UI - salvar lá (endpoint), OU manter ENV no deploy (UI só informativa). +- [x] **Ponte de config** (feito): config persiste na tabela `settings` + (`id=newwhats_config`); backend lê do DB com fallback ENV + (`config.js loadConfigFromDb`). UI dedicada (`NewwhatsConfigModal`) com + **dropdown de clínicas**, secrets que mantêm valor se em branco e **Testar + conexão** (`GET /api/nw/status`). Endpoints superadmin: `GET/PUT /api/nw/config`, + `GET /api/nw/clinicas`, `GET /api/nw/status`. - [ ] `webhook message.new`: capturar lead / acionar fluxo (hoje só loga). - [ ] Proxy WS (`/api/nw/v1/stream`) — só o REST foi portado (Inbox sem tempo real). - [ ] Parear scoreodonto com o motor (criar apiKey/pair + agente) e preencher as ENV.