Files · OpenAI Voice Agent for ServiceTitan Field Service Dispatch
68 (1 binary, 593.5 kB total)attempt 1
README.md·2292 B·markdown
markdown
# OpenAI Voice Agent for ServiceTitan Field Service Dispatch
Answers phone calls for field service businesses, converting voice instructions into ServiceTitan work orders automatically via OpenAI, Deepgram STT, Cartesia TTS, and Twilio telephony.
## Architecture
```
Twilio webhook → voice-agent-core pipeline (STT → MCP → TTS)
→ confidence-router → ServiceTitan OAuth2 client → work order creation
```
The Twilio inbound call webhook feeds audio into the voice agent pipeline: speech is transcribed via Deepgram (STT), processed through OpenAI to extract intent and entities, responses are synthesized with Cartesia (TTS). The confidence-router decides when to escalate or auto-create a ServiceTitan work order through the OAuth2-authenticated API client.
## Prerequisites
- Twilio account (phone number with voice capability, Media Streams enabled)
- Deepgram account (API key for STT)
- Cartesia account (API key for TTS)
- OpenAI account (API key for LLM orchestration)
- ServiceTitan account (client credentials for OAuth2 integration)
## Environment Variables
| Variable | Description |
|---|---|
| `NODE_ENV` | Environment mode (development/production) |
| `OPENAI_API_KEY` | OpenAI API key for LLM orchestration |
| `TWILIO_ACCOUNT_SID` | Twilio account SID |
| `TWILIO_AUTH_TOKEN` | Twilio auth token |
| `DEEPGRAM_API_KEY` | Deepgram API key for speech-to-text |
| `CARTESIA_API_KEY` | Cartesia API key for text-to-speech |
| `SERVICETITAN_CLIENT_ID` | ServiceTitan OAuth2 client ID |
| `SERVICETITAN_CLIENT_SECRET` | ServiceTitan OAuth2 client secret |
| `SERVICETITAN_TENANT_ID` | ServiceTitan tenant ID |
| `SERVICETITAN_APP_KEY` | ServiceTitan application key |
| `MCP_API_KEY` | MCP server API key |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OpenTelemetry OTLP HTTP exporter endpoint |
## Quick Start
```bash
git clone <repo-url>
cd openai-voice-agent-for-servicetitan-field-service-dispatch
pnpm install
cp .env.example .env
# Edit .env with your credentials
pnpm dev
```
Configure your Twilio phone number's voice webhook URL to point to your deployed instance's `/api/twilio/voice` endpoint.
## Development
Test the voice pipeline locally with the simulator:
```bash
npx @reaatech/voice-agent-simulator
```
## License
MIT — see [LICENSE](./LICENSE).