Quick guide to get Segment ready to receive data from the synthetic call generator.
- Go to https://app.segment.com
- Navigate to Connections → Sources
- Click Add Source
- Search for and select Node.js
- Name it:
Twilio Synthetic Call Generator - Click Add Source
- Copy the Write Key - it looks like
Ab3Cd4Ef5Gh6Ij7Kl8Mn9Op0Qr1St2U
Add this line to your .env file (create it from .env.example if needed):
SEGMENT_WRITE_KEY=your_actual_write_key_hereTo actually see the data, connect a destination to your source:
- The debugger is automatically available
- Go to Sources → Twilio Synthetic Call Generator → Debugger
- Data will appear here in real-time when you run the smoke test
- In your source, click Add Destination
- Search for Google Sheets
- Authorize with your Google account
- Configure which events to send
- Data will appear in a spreadsheet automatically
- Add Webhooks as a destination
- Point it to your own endpoint
- Useful for debugging or custom integrations
- BigQuery, Redshift, Snowflake, etc.
- Best for production analytics
- Requires warehouse setup
Run the smoke test to verify everything works:
npm run smoke-testYou should see:
✓ SEGMENT_WRITE_KEY is set
✓ Segment identify() call succeeded
✓ Segment flush() succeeded
✓ Created Segment profile for: Lucy Macintosh
✓ Updated Segment profile with call analytics
- Go to your source in Segment
- Click Debugger tab
- You should see events like:
identify- Customer profile creationtrack - call_completed- Call analytics
{
"userId": "cust_a3e3835ce1df229cce1271a25b0c8822",
"traits": {
"name": "Lucy Macintosh",
"email": "lucy.macintosh@example.com",
"phone": "+15129358764",
"technical_proficiency": "Medium",
"demeanor": "Calm but firm",
"total_calls": 0,
"churn_risk": 0,
"propensity_to_buy": 0,
"satisfaction_score": 0
}
}{
"userId": "cust_a3e3835ce1df229cce1271a25b0c8822",
"traits": {
"total_calls": 1,
"churn_risk": 25,
"propensity_to_buy": 75,
"satisfaction_score": 80,
"last_call_sentiment": "positive",
"last_call_resolution": "resolved",
"last_call_escalated": false
}
}{
"userId": "cust_a3e3835ce1df229cce1271a25b0c8822",
"event": "call_completed",
"properties": {
"sentiment": "positive",
"resolution": "resolved",
"escalation": false,
"wordCount": 150,
"churnRisk": 25,
"propensityToBuy": 75,
"satisfactionScore": 80
}
}- Double-check you copied the entire write key
- Make sure there are no extra spaces
- Verify it's from the Node.js source (not a different source type)
- Wait 5-10 seconds after running smoke test
- Refresh the debugger page
- Check that the source is not paused
- This is usually fine - it's async
- Data still gets sent
- Only a problem if it consistently fails
Segment has generous rate limits:
- Free tier: 1,000 events/month
- Team tier: 10,000 events/month
- Business tier: Unlimited
For this project:
- 10 customer profiles = 10 identify calls
- Each call generates 1 identify + 1 track = 2 events
- 100 synthetic calls = 210 events total
You're well within limits! 🎉
Once you verify the smoke test works:
- Run
npm run smoke-testto see it live - Check Segment debugger to see the data
- Set up a destination if you want to store/analyze the data
- Ready to generate synthetic call data at scale!