# Gemini AI Configuration # Get your API key from: https://aistudio.google.com/ GEMINI_API_KEY=your_gemini_api_key_here # Default Gemini model. Google retires models on a rolling schedule and a # retired name returns 404 on every call (collapses the bot into its # "we'll get back to you shortly" fallback). As of 2026-06 valid choices are # gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro, gemini-3.5-flash. # Retired model names already stored in the DB are auto-migrated to this on boot. GEMINI_DEFAULT_MODEL=gemini-2.5-flash # OpenAI Configuration (for Voice/STT/TTS) # Get your API key from: https://platform.openai.com/ OPENAI_API_KEY=your_openai_api_key_here # Groq AI Configuration (Fast inference) # Get your API key from: https://console.groq.com/ # RECOMMENDED as a failover for the Gemini free-tier daily cap: Groq's free # tier is far more generous and the load balancer tries Groq FIRST (priority 1). # Any provider key set here is auto-loaded as a failover provider even if you # have not added it in the Admin Panel. GROQ_API_KEY=your_groq_api_key_here # Current Groq model (the old default mixtral-8x7b-32768 is decommissioned). GROQ_MODEL=llama-3.3-70b-versatile # OpenRouter AI Configuration (Access 100+ models) # Get your API key from: https://openrouter.ai/keys OPENROUTER_API_KEY=your_openrouter_api_key_here # ============================================ # MongoDB Database Configuration (REQUIRED) # ============================================ # Get your connection string from MongoDB Atlas: https://cloud.mongodb.com/ # Format: mongodb+srv://:@.mongodb.net/?retryWrites=true&w=majority MONGODB_URI=your_mongodb_connection_string_here # ============================================ # Security Configuration # ============================================ # JWT Secret for Admin Panel authentication (min 32 chars recommended) # If not set, a random secret will be generated for development JWT_SECRET=your_secure_jwt_secret_key_here # Encryption key for API key storage in database (MUST be exactly 32 characters) # Used to encrypt sensitive data like AI provider API keys in the Config collection # REQUIRED in production; if not set in development a random key is generated (32 chars) ENCRYPTION_KEY=your_32_char_encryption_key_ # Secret used to sign/verify OAuth "state" parameters (CSRF protection on OAuth flows) OAUTH_STATE_SECRET=your_oauth_state_secret_here # Shared secret used to validate inbound/outbound webhook signatures WEBHOOK_SECRET=your_webhook_secret_here # ============================================ # Server Configuration # ============================================ # Server port (default: 8080) PORT=8080 # Environment (development, production) NODE_ENV=development # Comma-separated list of origins allowed by CORS (use * only for local development) ALLOWED_ORIGINS=http://localhost:5000,http://localhost:8080 # Maximum size accepted for JSON request bodies (e.g. 1mb, 5mb) JSON_BODY_LIMIT=5mb # ============================================ # Timeouts # ============================================ # Timeout (ms) for outbound AI provider requests AI_REQUEST_TIMEOUT_MS=30000 # Timeout (ms) for local NLP inference calls NLP_INFERENCE_TIMEOUT_MS=5000 # ============================================ # Admin bootstrap (first-run seeding) # ============================================ # On first boot, when the Admin collection is EMPTY, an admin is created from # these. Ignored once an admin exists (never overwrites). Set a strong password. SUPER_ADMIN_USERNAME=admin SUPER_ADMIN_PASSWORD=change_me_strong_password # Legacy aliases (either pair works; SUPER_ADMIN_* takes precedence). ADMIN_USERNAME=admin ADMIN_PASSWORD=change_me_strong_password # ============================================ # Branding / localisation # ============================================ BOT_NAME= BOT_PERSONALITY= BRAND_NAME= BRAND_NAME_SI= BRANCH_NAME= # Default response language: si (Sinhala) | en | ta. Also accepts english/tamil. DEFAULT_LANGUAGE=si # Country code prepended when normalising local phone numbers (Sri Lanka = 94). DEFAULT_COUNTRY_CODE=94 # ============================================ # AI model overrides (optional — sensible defaults in code) # ============================================ OPENAI_MODEL= OPENROUTER_MODEL= # Reasoning is OFF by default (reasoning models can exceed the request timeout). OPENROUTER_ENABLE_REASONING=false # ============================================ # Voice / TTS / STT # ============================================ GOOGLE_TTS_API_KEY= OPENROUTER_STT_MODEL= OPENROUTER_TTS_MODEL= OPENROUTER_TTS_VOICE= # TTS model for the call assistant: auto | gemini | openai | elevenlabs | google CALL_TTS_MODEL=auto # Incoming-call handling: reject-reply | live-answer LIVE_CALL_MODE=reject-reply VOICE_TELEPHONY_PROVIDER= # Auto-reply to rejected calls. Hard kill-switch: set to false to disable. CALL_ASSISTANT_ENABLED=false CALL_AUTO_REPLY_MESSAGE= CALL_LIVE_GREETING= # ============================================ # Content generation (marketing images) # ============================================ # Image provider: gemini | stability CONTENT_IMAGE_PROVIDER=gemini STABILITY_API_KEY= # ============================================ # WhatsApp Cloud API (Meta) — only if using the official Cloud API channel # ============================================ WHATSAPP_CLOUD_ACCESS_TOKEN= WHATSAPP_CLOUD_PHONE_NUMBER_ID= WHATSAPP_PHONE_NUMBER_ID= WHATSAPP_APP_SECRET= WHATSAPP_WEBHOOK_VERIFY_TOKEN= WHATSAPP_CALLING_API_TOKEN= WHATSAPP_GRAPH_VERSION=v25.0 META_GRAPH_VERSION=v25.0 # Delay (ms) before auto-starting WhatsApp sessions on boot. WHATSAPP_STARTUP_DELAY_MS=0 # Chat history sync. When enabled (default), WhatsApp ships the device's # existing chat history on pairing and it is stored so the admin Live Chat # shows conversations that pre-date the bot. Historical messages are # persisted only — they never reach the AI reply chain. # NOTE: WhatsApp only sends history to a NEWLY LINKED device; an already # paired session must be unlinked and re-scanned to get its history. WHATSAPP_SYNC_FULL_HISTORY=true # Safety cap on rows written per history batch. WHATSAPP_HISTORY_MAX_MESSAGES=50000 # Optional persistent/mounted directory for Live Chat media. Defaults to # ./uploads/chat-media; set this in container deployments so redeploys do not # discard images, documents and voice notes. CHAT_MEDIA_DIR= # ============================================ # Staff accounts # ============================================ # How long sign-in attempts (Users → Login history) are kept, in days. # Every login writes one row, so this bounds the collection. LOGIN_HISTORY_RETENTION_DAYS=180 # ============================================ # OAuth / integrations # ============================================ # Base URL used to build OAuth redirect URIs (defaults to the request host). OAUTH_REDIRECT_BASE= # SendGrid inbound-event webhook signature public key (event webhook verify). SENDGRID_WEBHOOK_PUBLIC_KEY= # ============================================ # Kiosk (in-branch voice consult) # ============================================ # Kiosk invite code time-to-live (ms). KIOSK_CODE_TTL= # ============================================ # Lead / forms # ============================================ # CV upload form URL. If UNSET the bot sends NO link (never a placeholder). CV_UPLOAD_URL= # ============================================ # Local NLP sidecar (optional — see inference_server.py; not deployed by default) # ============================================ NLP_SERVER_URL=http://localhost:8001 NLP_HEALTH_CHECK_INTERVAL_MS=30000 NLP_HEALTH_CHECK_TIMEOUT_MS=2000 # ============================================ # Retention & tuning (optional) # ============================================ CONVERSATION_RETENTION_DAYS=90 AUDIT_RETENTION_DAYS=365 # Cooldown (ms) applied to a provider after repeated 429s before retrying it. AI_RATE_LIMIT_COOLDOWN_MS=60000 GEMINI_SESSION_TTL_MS= # Verbose debug logging. DEBUG=false