⚡ Get up and running in 5 minutes - This is a condensed guide for developers who want to try the system immediately.
For production deployment with advanced configuration, see deployment-guide.md
- Node.js v18+ installed
- Twilio Account with credits
- Segment Workspace (free tier OK)
- 10 minutes of your time
# Clone the repository
git clone <repository-url>
cd twilio-synthetic-call-data-generator
# Install dependencies
npm installCreate .env file:
cp .env.example .envEdit .env with your credentials:
# Get these from https://console.twilio.com
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token_here
# Get this from https://app.segment.com → Connections → Sources → Node.js
SEGMENT_WRITE_KEY=your_segment_write_key_here
# Optional: For testing
AGENT_PHONE_NUMBER=+15551234567Where to find credentials:
- Twilio: console.twilio.com → Account Info
- Segment: app.segment.com → Connections → Sources → Add Source → Node.js → Copy Write Key
Run the pre-deployment check:
npm run pre-deployExpected output:
✓ ALL CHECKS PASSED (7/7)
🎉 Ready for deployment!
If any checks fail, follow the error messages to fix them.
Deploy serverless functions:
npm run deployThis will:
- Run pre-deployment checks
- Deploy functions to Twilio
- Run post-deployment validation
Expected output:
✓ ALL VALIDATIONS PASSED (4/4)
🎉 Deployment is healthy and operational!
Set up real-time error monitoring with Twilio Debugger webhook:
npm run configure-debuggerThis will display instructions for manual configuration. Follow these steps:
- Go to console.twilio.com/monitor/debugger
- Click Settings (gear icon in top right)
- Under Webhook, enter the URL shown in the script output
- Click Save
What this does:
- Captures ALL Twilio errors/warnings in real-time
- Automatically classifies error severity (CRITICAL, HIGH, MEDIUM, LOW)
- Takes automated remediation actions
- Structured JSON error logging for debugging
For more details, see error-handling-guide.md.
Run a test generation:
node src/main.jsWhat happens:
- Loads 10 customers and 10 agents
- Selects intelligent customer-agent pairing
- Creates Segment profiles
- Creates Twilio conference
- Adds participants with AI conversation
- Simulates call completion
- Updates Segment with ML scores
- Go to console.twilio.com/monitor/logs/conferences
- See your generated conference
- Click to view participants
- Go to app.segment.com
- Navigate to Connections → Sources → Your Source → Debugger
- See events:
identifycalls with customer profilescall_completedtrack events with analytics
- Go to console.twilio.com/monitor/debugger
- View any errors/warnings from your calls
- Check Function logs to see error handler responses
- Verify automated remediation actions are logged
# Pre-deployment validation
npm run pre-deploy
# Deploy with extra safety (includes smoke test)
npm run deploy:safe
# Post-deployment validation only
npm run post-deploy
# Run smoke test (tests real APIs without deploying)
npm run smoke-test
# Run all tests
npm test
# Test coverage report
npm run test:coverage
# Start local development server
npm run devSolution: Add credentials to .env file
Solution: Verify credentials at console.twilio.com
Solution:
- Go to app.segment.com
- Connections → Sources → Add Source → Node.js
- Copy the Write Key to
.env
Solution:
npm run test:coverageCheck which tests are failing and fix them.
Solution:
twilio login
twilio serverless:deploySolution:
- Verify Debugger webhook is configured in Twilio Console
- Check the webhook URL matches your deployed function
- Test with an intentional error (invalid phone number)
- View Function logs to verify webhook receives requests
- Read the full docs: deployment-guide.md
- Understand the API: api-documentation.md
- Configure Segment destinations: segment-setup-guide.md
- Scale up: Generate multiple conferences, set up cron jobs, etc.
Before deploying to production:
- All tests passing (
npm test) - Pre-deployment checks passing (
npm run pre-deploy) - Smoke test passing (
npm run smoke-test) - Credentials configured in
.env - Segment destinations configured
- Twilio phone numbers provisioned
- Usage limits and alerts configured
- Monitoring set up
- Error handler webhook configured
- Debugger webhook tested with intentional error
Deploy with:
npm run deploy:safe- Documentation: See
docs/directory - Issues: Create a GitHub issue
- Twilio Support: support.twilio.com
- Segment Support: segment.com/help
You're ready to generate synthetic call data! 🎉
Run node src/main.js to create your first synthetic conference call.