This guide will walk you through setting up the ElevenLabs native outbound calling for automated reference calling.
- ElevenLabs Account with Conversational AI access
- Twilio Account with a phone number
- Your credentials from both services
- Go to ElevenLabs Dashboard
- Navigate to "Conversational AI" section
- Click "Create Agent"
- Configure your agent with this prompt:
You are a professional HR assistant conducting reference checks. Your job is to have natural, friendly conversations with references to gather information about candidates.
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
-
Important: Configure audio formats in your agent settings:
- Voice Section: Select "μ-law 8000 Hz" for TTS output
- Advanced Section: Select "μ-law 8000 Hz" for input format
-
Copy the Agent ID (format:
agent_xxxxxxxxxxxxxxxx)
- In your ElevenLabs workspace, go to "Phone Numbers"
- Click "Add Phone Number"
- Select "Twilio" as the provider
- Enter your Twilio phone number
- Create a workspace secret with your Twilio Auth Token
- Copy the Phone Number ID that gets generated
- Copy the environment template:
cp env.sample frontend/.env.local- Fill in your credentials in
frontend/.env.local:
# Next.js Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_APP_ENV=development
# Twilio Configuration
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=+1234567890
# ElevenLabs Configuration
ELEVENLABS_API_KEY=your_elevenlabs_api_key
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
# ElevenLabs Conversational Agent
ELEVENLABS_AGENT_ID=agent_your_agent_id_here
ELEVENLABS_AGENT_PHONE_ID=your_agent_phone_number_id- Install dependencies:
cd frontend
npm install- Start the development server:
npm run dev-
Test with a call to your own phone number first!
- User fills out form with candidate and reference details
- API calls ElevenLabs native outbound call endpoint
- ElevenLabs handles everything: Creates conversation, calls Twilio, places call
- Twilio delivers call to the reference's phone
- AI agent conducts the reference check conversation
- Variables are passed to personalize the conversation
- Call is managed entirely by ElevenLabs
-
Navigate to
/callin your browser -
Fill in the form:
- Candidate Name: "John Doe"
- Reference Name: "Jane Smith"
- Phone Number: Your own phone number (for testing)
- Company: "Tech Corp"
- Role: "Software Engineer"
- Duration: "2 years"
-
Click "Start Reference Call"
-
You should receive a call from your Twilio number
-
The AI agent should introduce itself and start the reference check
If the call doesn't work:
- Check your browser's developer console for errors
- Verify all environment variables are set correctly
- Ensure your ElevenLabs agent ID is correct
- Confirm your Twilio phone number is verified
- Check that the Phone Number ID from ElevenLabs is correct
- Verify audio formats are set to μ-law 8000 Hz
Common Issues:
- 401 Unauthorized: Check your ElevenLabs API key
- 400 Bad Request: Verify your agent ID format
- Call not connecting: Ensure Twilio integration is properly set up in ElevenLabs
- Audio problems: Check audio format settings in your agent
- Never commit
.env.localfiles to version control - Always get consent before recording calls
- Comply with local calling and recording regulations
- Use the system responsibly and ethically
Once everything is working, you'll have:
- ✅ Native ElevenLabs integration: No complex WebSocket setup
- ✅ Automated reference calling: Direct API calls
- ✅ Natural AI conversations: Professional reference checking
- ✅ Dynamic personalization: Variables passed to each call
- ✅ Reliable delivery: ElevenLabs handles all the complexity
- No localhost issues: Everything runs through ElevenLabs' cloud
- No WebSocket complexity: Simple API calls
- No custom server needed: Native integration
- Better reliability: Official ElevenLabs approach
- Easier debugging: Clear API responses
The system now uses the official ElevenLabs outbound call API:
await client.conversationalAi.twilio.outboundCall({
agentId: process.env.ELEVENLABS_AGENT_ID,
agentPhoneNumberId: process.env.ELEVENLABS_AGENT_PHONE_ID,
toNumber: phoneNumber,
conversationInitiationClientData: {
candidate_name: candidateName,
reference_name: referenceName,
company_name: companyName,
// ... other variables
}
});This approach is much simpler and more reliable than custom WebSocket handling!
Happy reference checking! 🚀