This project implements an AI-powered inbound call agent for Bart's Automotive, a fictional automotive business. It uses OpenAI's new realtime API and integrates with Twilio to handle incoming phone calls.
https://youtu.be/AZ0WziqO_QA?si=HORqrwjrbKnsuRZY
- Handles incoming calls using Twilio's voice services
- Utilizes OpenAI's realtime API for natural language processing
- Transcribes user speech and generates AI responses in real-time
- Extracts customer details (name, availability, and special notes) from the conversation
- Sends extracted information to a webhook for further processing
- Node.js
- Fastify (web framework)
- WebSocket (for real-time communication)
- OpenAI GPT-4 Realtime API
- Twilio (for telephony services)
- dotenv (for environment variable management)
-
Clone the repository:
git clone https://github.com/Barty-Bart/openai-realtime-api-voice-assistant.git cd openai-realtime-api-voice-assistant
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:OPENAI_API_KEY=your_openai_api_key
Replace
your_openai_api_key
with your actual OpenAI API key. -
Update the webhook URL: Open the
index.js
file and locate theWEBHOOK_URL
constant. Replace the existing URL with your own webhook URL:const WEBHOOK_URL = "https://your-webhook-url.com";
-
Start the server:
npm start
Once the server is running, it will handle incoming Twilio calls. The AI agent will engage with callers, transcribe their speech, generate appropriate responses, and extract relevant information from the conversation.
This project is a demonstration and should be adapted for production use, including proper error handling, security measures, and compliance with relevant regulations.
Contributions are welcome! Please feel free to submit a Pull Request.