LeCommit's AI-Powered Reference Validation System
This document explains how our automated reference calling feature works using ElevenLabs Native Outbound Call API and Twilio Voice.
The Reference Calling feature automatically calls candidate references and conducts professional interviews using AI to validate their background and experience. This system eliminates manual reference checking while providing detailed analysis and credibility scoring.
- Native Integration: Direct ElevenLabs Conversational AI calls
- Zero Setup Complexity: No webhooks or custom servers required
- Professional: AI conducts natural, professional conversations
- Scalable: Handle multiple reference checks simultaneously
- Consistent: Same question framework, personalized execution
- Real-time: Instant call initiation and management
Location: http://localhost:3000/call
The /call page provides a clean, intuitive interface for initiating reference calls:
- Phone Number* (required): Reference contact number (e.g.,
+1234567890) - Candidate Name* (required): Person being referenced (e.g.,
John Doe) - Reference Name* (required): Person to call (e.g.,
Jane Smith) - Company Name (optional): Workplace context (e.g.,
Google) - Role Title (optional): Position context (e.g.,
Software Engineer) - Work Duration (optional): Timeline info (e.g.,
2 years)
The form shows users exactly what questions the AI will ask:
- "In what context did you work with [Candidate] at [Company]?"
- "Can you share any projects you remember [Candidate] working on?"
- "How would you describe [Candidate]'s work style?"
- "What were [Candidate]'s main strengths?"
- "Would you work with [Candidate] again?"
After successful submission, users see:
- ✅ Success message
- Conversation ID: Unique identifier for the call
- Call SID: Twilio call reference
- Timestamp: When the call was initiated
graph TB
subgraph "LeCommit Frontend"
A[/call Page Form] --> B[Form Submission]
B --> C[API Route /api/reference-call]
end
subgraph "Backend Processing"
C --> D[ElevenLabsClient]
D --> E[outboundCall API]
end
subgraph "ElevenLabs Cloud"
E --> F[Conversational Agent]
F --> G[Twilio Integration]
G --> H[Phone Call Delivery]
end
subgraph "Call Execution"
H --> I[Reference Person]
I --> J[AI Conversation]
J --> K[Natural Q&A]
end
style A fill:#e1f5fe
style F fill:#f3e5f5
style G fill:#e8f5e8
style K fill:#fff3e0
import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';
const client = new ElevenLabsClient({
apiKey: process.env.ELEVENLABS_API_KEY
});
export async function POST(request: NextRequest) {
const { phoneNumber, candidateName, referenceName, companyName, roleTitle, workDuration } = await request.json();
// Direct API call to ElevenLabs
const callResponse = await client.conversationalAi.twilio.outboundCall({
agentId: process.env.ELEVENLABS_AGENT_ID!,
agentPhoneNumberId: process.env.ELEVENLABS_AGENT_PHONE_ID!,
toNumber: phoneNumber
});
return NextResponse.json({
success: true,
conversationId: callResponse.conversationId,
callSid: callResponse.callSid,
message: callResponse.message
});
}# ElevenLabs Configuration
ELEVENLABS_API_KEY=sk_xxxxxxxxxxxxx
ELEVENLABS_AGENT_ID=agent_xxxxxxxxxxxxx
ELEVENLABS_AGENT_PHONE_ID=phnum_xxxxxxxxxxxxx
# Twilio Configuration (handled by ElevenLabs)
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=xxxxxxxxxxxxx
TWILIO_PHONE_NUMBER=+1234567890Prompt Template:
You are a professional HR assistant conducting reference checks.
CONVERSATION FLOW:
1. Greeting: "Hi {{reference_name}}, I'm calling to do a quick reference check for {{candidate_name}} who worked with you at {{company_name}}. Do you have about 3-4 minutes?"
2. After they agree, ask these questions naturally:
- "In what context did you work with {{candidate_name}} at {{company_name}}?"
- "Can you share any projects you remember {{candidate_name}} working on?"
- "How would you describe {{candidate_name}}'s work style and reliability?"
- "What were {{candidate_name}}'s main strengths?"
- "Were there any areas where {{candidate_name}} could improve?"
- "Would you work with {{candidate_name}} again if you had the opportunity?"
3. Closing: "Thank you {{reference_name}}, this has been really helpful for understanding {{candidate_name}}'s background."
GUIDELINES:
- Keep it conversational and natural
- Listen to their responses and ask simple follow-ups
- Don't rush through questions
- Be respectful of their time
- Keep the whole call under 5 minutes
Audio Settings:
- Input Format: μ-law 8000 Hz
- Output Format: μ-law 8000 Hz
- Voice: Professional, clear tone
sequenceDiagram
participant U as User
participant F as /call Form
participant A as API Route
participant E as ElevenLabs
participant T as Twilio
participant R as Reference
U->>F: Fill form & submit
F->>A: POST /api/reference-call
A->>E: outboundCall() with agent
E->>T: Initiate call via Twilio
T->>R: Ring reference phone
R->>T: Answer call
T->>E: Connect to AI agent
E->>R: AI conducts conversation
E->>A: Return conversation ID
A->>F: Success response
F->>U: Show success message
Location: frontend/src/components/ReferenceCallForm.tsx
Features:
- Form validation for required fields
- Loading states during API calls
- Success/error message display
- Context hints for better user experience
- Professional UI with Tailwind CSS
Location: frontend/src/app/call/page.tsx
Features:
- Dedicated page for reference calling
- Clean, focused interface
- Integration with ReferenceCallForm component
- Responsive design
Simplified Architecture:
- Single API endpoint:
/api/reference-call - Direct ElevenLabs SDK usage
- No webhooks or complex server setup
- Environment-based configuration
- Zero Complexity: No custom WebSocket servers
- No Localhost Issues: Everything runs in the cloud
- Better Reliability: Official ElevenLabs integration
- Easier Debugging: Clear API responses
- Faster Development: Direct SDK usage
- Professional Quality: Enterprise-grade voice AI
- ElevenLabs account with Conversational AI access
- Configured agent with proper audio formats
- Twilio integration in ElevenLabs workspace
- Environment variables properly set
- Phone number verification
- Conversation ID: Unique identifier for each call
- Call SID: Twilio reference number
- Timestamps: Call initiation times
- Success/Failure States: API response monitoring
console.log('ElevenLabs call initiated successfully:', {
conversationId: callResponse.conversationId,
callSid: callResponse.callSid,
success: callResponse.success,
message: callResponse.message
});- Call Result Storage: Database integration for call outcomes
- Real-time Status: WebSocket updates for call progress
- Batch Processing: Multiple reference calls at once
- Advanced Analytics: Sentiment analysis and scoring
- Integration: ATS and CRM system connections
- Concurrent Calls: ElevenLabs handles multiple calls
- Rate Limiting: Built-in API rate management
- Error Handling: Comprehensive error responses
- Monitoring: CloudWatch/logging integration
- Environment variables for sensitive data
- No storage of phone numbers or personal data
- HTTPS encryption for all API calls
- Compliance with calling regulations
- Always get consent before recording
- Comply with local calling laws (TCPA, etc.)
- Use professional, respectful language
- Limit call duration and frequency
This implementation provides a production-ready, scalable solution for automated reference checking using cutting-edge AI technology.