ComercialRS — CRM de Vendas
URLs e Credenciais
- - URL: https://comercialrs.rochasalesseguros.com.br
- - Path VPS:
/var/www/comercialrs - - Porta: 3010
- - Build: TanStack Start (React + Vite)
- - Supabase:
dauftiqcvgaydddoxqhh(West US Oregon) - - Frontend: React + TanStack Router + Tailwind + shadcn/ui
- - Backend: Supabase Cloud
- - Auth: Google OAuth (via Lovable + GoTrue local porta 9999)
- - WhatsApp: Meta WhatsApp Business API
- -
crm_auto_sync— toggle sync automática server-side - -
crm_last_synced_at/crm_last_sync_count/crm_last_sync_status - -
provider—n8noumeta - - Meta credentials:
meta_access_token,meta_phone_number_id,meta_waba_id,meta_business_id - - UAZAPI:
uazapi_url,uazapi_token,uazapi_phone - - Webhook:
webhook_url,webhook_mode - - in_progress: iniciada, começou, andamento, start, started
- - completed: concluída, finalizada, done, fechada
- - remarketing: remarketing, remar, rmk, remercar
- - Date filter null guard em Dashboard.tsx
- - Alert throttle (30min anti-duplicado)
- - useMeetingAlerts.ts interval 30s → 150s (2h30)
Stack Técnica
Nginx — Proxy Reverso
`
/rest/v1/* → https://dauftiqcvgaydddoxqhh.supabase.co (apikey anônima embedada)
/storage/v1/* → https://dauftiqcvgaydddoxqhh.supabase.co
/functions/v1/* → https://dauftiqcvgaydddoxqhh.supabase.co
/auth/v1/* → http://127.0.0.1:9999 (GoTrue local)
`
Tabelas Principais (Supabase)
automations
| Coluna | Tipo | Descrição |
| --- | --- | --- |
| id | uuid | PK |
| key | text | Identificador único |
| name | text | Nome |
| description | text | Descrição |
| icon | text | Ícone |
| status | boolean | Ativo/inativo |
| last_run_at | timestamptz | Último execução |
| Coluna | Tipo | Descrição |
| --- | --- | --- |
| id | uuid | PK — mesmo que auth.users.id |
| user_id | uuid | FK → auth.users.id |
| full_name | text | Nome completo |
| text | ||
| role | text | Papel |
| onboarding_done | boolean | Onboarding completo |
| Coluna | Tipo | Descrição |
| --- | --- | --- |
| id | uuid | PK — DIFERENTE de profiles.id |
| profile_id | uuid | FK → profiles.id |
| name | text | Nome |
| phone | text | Telefone |
| role | text | Papel |
| Coluna | Tipo | Descrição |
| --- | --- | --- |
| id | uuid | PK |
| created_by | uuid | FK → profiles.id |
| responsible_id | uuid | FK → team_members.id |
| title | text | Título |
| status | text | Status: todo, in_progress, completed, remarketing |
| due_date | timestamptz | Data de vencimento |
| Key | Nome | Trigger |
| --- | --- | --- |
| whatsapp_reminders | Lembrete de Reunião | 30min antes |
| risk_alerts | Alerta de Reunião Atrasada | Quando atrasa |
| daily_briefing | Briefing Diário | 10h, 13h, 17h |
| weekly_closing | Encerramento Semanal | Sexta |
WhatsApp — Meta Business API
Fluxo Bidirecional
1. dispatch-automation envia template Meta → corretor
2. Corretor responde "iniciada" / "concluída" / "remarketing"
3. Meta envia webhook → meta-webhook Edge Function
4. Extrai meta_message_id → busca task_id
5. Atualiza status da task
Keywords de Status
⚠️ REGRA CRÍTICA
NÃO tocar webhook no banco de dados — conexão já está no site UAZAPI/Meta.
Tocar = bloqueio do número WhatsApp.
Bugs Corrigidos (2026)
Build e Deploy
`bash
cd /var/www/comercialrs
nvm use 20
npm run build
Output: /var/www/comercialrs/dist/
`
Última atualização: 2026-06-13