SAGEA LogoDocs & API
CookbooksMYLO Cookbooks

Analyze Transcripts and Call Analytics

Turn MYLO voice transcripts into handle-time metrics, summaries, and CSV exports.

  • Fetch speaker turns with text and timestamps
  • Compute handle time, turn counts, and simple summaries
  • Export analytics rows to CSV for dashboards Time to complete: ~15 minutes

Prerequisites

  • SAGEA_API_KEY exported in your shell as Bearer auth
  • Python 3.10+ with requests installed
  • At least one completed MYLO session_id
  • Complete Send your first API request
  • Read the MYLO overview import from '@/components/Tabs';

Step 1: Fetch the transcript

Pull turns with speaker, text, and timestamps for a finished session.

SESSION_ID="mylo_ses_REPLACE_ME"
curl https://api.sagea.space/mylo/sessions/$SESSION_ID/transcript \
  -H "Authorization: Bearer $SAGEA_API_KEY" -o transcript.json
cat transcript.json

Each turn includes speaker, text, start_ms, and end_ms for timing.

Step 2: Compute handle time and summary

Derive duration, turn counts, and a lightweight sentiment summary.

python3 -c "import json; t=json.load(open('transcript.json')).get('turns',[]); print('turns:',len(t))"
# handle_s = last end_ms minus first start_ms, divided by 1000

Handle time is last end_ms minus first start_ms, converted to seconds.

Step 3: Export analytics to CSV

Write one row per session so BI tools can chart volume and handle time.

cat mylo_analytics.csv
# session_id,turns,handle_s,user_turns,sentiment

Append daily and delete test sessions with DELETE /mylo/sessions.

Verify

ErrorCauseFix
401 UnauthorizedMissing or invalid API keyExport valid SAGEA_API_KEY and retry
404 session_not_foundTranscript for deleted sessionFetch before delete, archive JSON first
429 rate_limit_exceededBulk transcript pulls throttledPaginate IDs, add sleep between calls
422 voice_not_foundUnrelated voice error in logsIgnore for analytics, fix at session create

What's next

On this page