A real-time voice agent system for diamond sales using Twilio, OpenAI, and Supabase with low-latency audio streaming.
This system provides a conversational AI agent that can handle incoming phone calls, understand diamond-related queries, and provide real-time responses with inventory lookups from a Supabase database.
- Real-time voice interaction via Twilio Programmable Voice
- OpenAI speech-to-speech integration for natural conversations
- Intent detection for diamond-related queries (carat, cut, color, clarity)
- Live inventory lookup from Supabase database
- Sub-500ms response latency
- Call transcription and interaction logging
- Live dashboard for monitoring calls and agent performance
- Telephony Layer: Twilio Programmable Voice with WebSocket streaming
- Voice Processing: OpenAI Realtime API for speech-to-speech
- Intent Detection: Real-time analysis of customer queries
- Database: Supabase PostgreSQL for diamond inventory and call logs
- Backend: Node.js/Express with WebSocket support
- Frontend: React dashboard for monitoring and analytics
- Clone the repository
- Copy
.env.exampleto.envand fill in your credentials - Run database migrations:
npm run db:migrate - Start the development server:
npm run dev - Configure Twilio webhook to point to your server
See .env.example for required environment variables including:
- Twilio credentials
- OpenAI API key
- Supabase database URL
- Server configuration
POST /api/voice/webhook- Twilio voice webhookGET /api/calls- List call sessionsGET /api/diamonds- Diamond inventoryPOST /api/diamonds/search- Search diamonds by criteria
call:start- New call initiatedcall:transcript- Real-time transcriptionintent:detected- Diamond query detectedagent:response- AI agent response
npm run dev # Start development server
npm run db:studio # Open database studio
npm run build # Build for production
npm run start # Start production serverThis project is configured for deployment on Replit with automatic builds and health checks.