How diogobrazil/bot-clinica-vida works
VIDA Bot is a clinic appointment and information service delivered through WhatsApp, with a staff web panel for conversation handoff and clinic administration. The main user flow is an incoming WhatsApp message through the webhook into the bot FSM, followed by a response through the WhatsApp sender; the README identifies the bot as deterministic and FSM-based. The panel separately supports staff conversations and management of scheduling and clinic data. Several important modules are unsampled, so those branches are shown only where the README or SOURCE INDEX supports the relationship.
Main entry points: webhook.py Message webhook · fsm.py Conversation FSM · webhook_handlers.py Webhook workflows · client.ts HTTP API client
Components 25
WhatsApp channel
- Message webhook
app/whatsapp/webhook.py - Message templates
app/whatsapp/templates - WhatsApp sender
app/whatsapp/sender.py
Bot and domain
- Conversation FSM
app/bot/fsm.py - Bot handlers
app/bot/handlers.py - Business hours
app/domain/services/business_hours.py - Scheduling services
app/domain/services/scheduling.py - FAQ and LLM
app/domain/services/llm.py - Human handoff
app/bot/handoff.py - Webhook workflows
app/bot/webhook_handlers.py
Persistence and API
- FastAPI entry
app/main.py - Clinic data models
app/domain/models - Session repository
app/infra/repositories/session_repo.py - Message repository
app/infra/repositories/message_repo.py - PostgreSQL
- Clinic and staff API
app/api - Panel WebSocket
app/api/ws.py
Staff panel
- Panel routes
panel/src/App.tsx - Panel authentication
panel/src/hooks/useAuth.tsx - HTTP API client
panel/src/api/client.ts - Schedule management
panel/src/pages/Schedule.tsx - Conversation console
panel/src/components/ChatWindow.tsx
Other components
- Patient
- WhatsApp Cloud API
- Clinic staff
Connections 29
- Patient → WhatsApp Cloud API: sends messages
README.md - WhatsApp Cloud API → Message webhook: delivers webhook
README.md - FastAPI entry → Message webhook: mounts route
app/main.py - Message webhook → Conversation FSM: processes message
app/whatsapp/webhook.py - Message webhook → Business hours: checks hours
app/whatsapp/webhook.py - Message webhook → Human handoff: routes handoff
app/whatsapp/webhook.py - Message webhook → Webhook workflows: delegates workflow
app/whatsapp/webhook.py - Message webhook → Session repository: loads session
app/whatsapp/webhook.py - Message webhook → Message repository: records messages
app/whatsapp/webhook.py - Webhook workflows → WhatsApp sender: sends replies
app/bot/webhook_handlers.py - Webhook workflows → Panel WebSocket: broadcasts updates
app/bot/webhook_handlers.py - Webhook workflows → Message templates: formats replies
app/bot/webhook_handlers.py - Conversation FSM → Bot handlers: dispatches state
- Conversation FSM → Scheduling services: runs booking flow
- Conversation FSM → FAQ and LLM: resolves questions
- WhatsApp sender → WhatsApp Cloud API: posts messages
app/whatsapp/sender.py - FastAPI entry → Clinic and staff API: mounts routers
app/main.py - Clinic staff → Panel routes: uses panel
panel/src/App.tsx - Panel routes → Panel authentication: checks identity
panel/src/App.tsx - Panel authentication → HTTP API client: calls auth API
panel/src/hooks/useAuth.tsx - Panel routes → Schedule management: routes schedule
panel/src/App.tsx - Schedule management → HTTP API client: requests schedule data
panel/src/pages/Schedule.tsx - HTTP API client → Clinic and staff API: calls HTTP endpoints
panel/src/api/client.ts - HTTP API client → Conversation console: loads conversations
- Conversation console → Panel WebSocket: receives live updates
- Session repository → Clinic data models: persists sessions
app/infra/repositories/session_repo.py - Message repository → Clinic data models: stores message records
app/infra/repositories/message_repo.py - Clinic data models → PostgreSQL: maps clinic data
- Clinic and staff API → Clinic data models: manages clinic records
app/api/auth_deps.py