# 2BHK Sales Agent

Outbound voice agent that calls customers, speaks in Hindi/Gujarati/Hinglish,
and qualifies them for a 2 BHK flat purchase.

## Flow
```
Agent calls customer
       ↓
Exotel WebSocket → Your server
       ↓
Greeting plays (Hindi)
       ↓
Customer speaks → Sarvam STT → transcript
       ↓
AI → generates reply
       ↓
Sarvam TTS → audio
       ↓
Audio plays on call
       ↓ (repeat until call ends)
```

## Setup

### 1. Install
```bash
npm install
```

### 2. Configure .env
```bash
cp .env.example .env
```
Fill in:
- `EXOTEL_ACCOUNT_SID`, `EXOTEL_API_KEY`, `EXOTEL_API_TOKEN`
- `EXOTEL_CALLER_ID` — your Exophone number
- `NGROK_HOST` — your ngrok URL (without https://)
- `SARVAM_API_KEY` — from dashboard.sarvam.ai
- `ANTHROPIC_API_KEY` — from console.anthropic.com

### 3. Start ngrok
```bash
ngrok http 3000
# Copy the URL e.g. abc123.ngrok-free.app
# Paste into .env as NGROK_HOST=abc123.ngrok-free.app
```

### 4. Start server
```bash
npm run dev
```

### 5. Exotel App Bazaar
In Voicebot Applet set URL:
```
wss://abc123.ngrok-free.app/voicebot
```

### 6. Trigger a call
```bash
curl -X POST http://localhost:3000/exotel/call \
  -H "Content-Type: application/json" \
  -d '{ "to": "+91XXXXXXXXXX" }'
```

## Agent Script
- Priya greets the customer in Hindi
- Asks if they want to buy a 2 BHK flat
- Qualifies: budget, location, timeline, home loan needed
- Automatically replies in the customer's language (Hindi/Gujarati/Hinglish)
- Ends the call politely and says a team member will follow up

## API Keys Needed
| Service | Get Key From |
|---------|-------------|
| Sarvam AI | dashboard.sarvam.ai |
| groqcloud | console.groq.com |
| Exotel | your Exotel dashboard |


