Skip to content

arjvand/Call-Transcript-Analyzer-CLI

Repository files navigation

Call Transcript Analyzer CLI

A Node.js command-line tool that fetches call transcripts from Close CRM, analyzes them using OpenAI ChatGPT batch processing, and generates summary reports with percentage breakdowns.

Features

  • Fetch Transcripts: Download call transcripts from Close CRM with flexible filtering options
  • AI-Powered Analysis: Process transcripts using OpenAI ChatGPT with custom analysis questions
  • Summary Reports: Generate reports with percentage breakdowns and visualizations
  • Flexible Filtering: Filter by date range, SDR name, and deal stage
  • Multiple Export Formats: Console output, JSON, and CSV exports

Prerequisites

  • Node.js: Version 18.x or higher
  • Close CRM API Key: Required for fetching transcripts
  • OpenAI API Key: Required for analyzing transcripts

Installation

npm install -g call-transcript-analyzer

Or for local development:

git clone <repository-url>
cd call-transcript-analyzer
npm install
npm link

Configuration

1. Environment Variables

Create a .env file in your project directory:

# Required
CLOSE_API_KEY=api_your_close_crm_key_here
OPENAI_API_KEY=sk-your_openai_key_here

# Optional
OPENAI_MODEL=gpt-4o-mini
LOG_LEVEL=info
OUTPUT_DIR=./analysis-results

Available OpenAI Models:

  • gpt-4o-mini (default) - Fast and cost-effective
  • gpt-4o - More capable, higher cost
  • gpt-4-turbo - Previous generation, good balance
  • gpt-3.5-turbo - Fastest, lowest cost

Choose based on your accuracy requirements and budget.

2. Questions Configuration

Create a questions.json file defining your analysis questions:

[
  {
    "id": "q1",
    "text": "Did the SDR build rapport with the prospect?",
    "answerFormat": "multiple_choice",
    "options": ["Yes", "No", "Partially"],
    "includeInReport": true
  },
  {
    "id": "q2",
    "text": "Rate the SDR's objection handling (1-5)",
    "answerFormat": "rating_scale",
    "scaleRange": { "min": 1, "max": 5 },
    "includeInReport": true
  }
]

See config/questions.example.json for more examples.

Quick Start

1. Fetch Transcripts

call-analyzer fetch \
  --start-date 2025-10-01 \
  --end-date 2025-10-31 \
  --output ./analysis-results

2. Analyze Transcripts

call-analyzer analyze \
  --input ./analysis-results/transcripts \
  --questions ./questions.json \
  --output ./analysis-results/analyzed

3. Generate Report

call-analyzer report \
  --input ./analysis-results/analyzed \
  --questions ./questions.json

Commands

fetch - Download Call Transcripts

Fetch call transcripts from Close CRM.

call-analyzer fetch [options]

Options:

  • --start-date <date> - Start date in YYYY-MM-DD format
  • --end-date <date> - End date in YYYY-MM-DD format
  • --sdr <name> - Filter by SDR name
  • --stage <stage> - Filter by deal stage (Discovery, Demo, Negotiation, etc.)
  • -o, --output <dir> - Output directory (default: ./analysis-results)

Example:

call-analyzer fetch --start-date 2025-10-01 --end-date 2025-10-31 --sdr "John Smith"

analyze - Analyze Transcripts with AI

Process transcripts using OpenAI ChatGPT batch API.

call-analyzer analyze [options]

Options:

  • -i, --input <dir> - Input directory with transcript files
  • -q, --questions <file> - Questions configuration file
  • -o, --output <dir> - Output directory for analysis results
  • --overwrite - Overwrite existing analysis results

Example:

call-analyzer analyze --input ./transcripts --questions ./questions.json --output ./analyzed

report - Generate Summary Reports

Generate aggregate reports from analyzed transcripts.

call-analyzer report [options]

Options:

  • -i, --input <dir> - Input directory with analysis results
  • -q, --questions <file> - Questions configuration file
  • -f, --format <format> - Output format: console, json, or csv (default: console)
  • -o, --output <file> - Output file path (required for json/csv)
  • --start-date <date> - Filter results by start date
  • --end-date <date> - Filter results by end date
  • --sdr <name> - Filter results by SDR name
  • --stage <stage> - Filter results by deal stage

Examples:

# Console output
call-analyzer report --input ./analyzed --questions ./questions.json

# Export to JSON
call-analyzer report --input ./analyzed --questions ./questions.json --format json --output report.json

# Export to CSV
call-analyzer report --input ./analyzed --questions ./questions.json --format csv --output report.csv

# Filtered report
call-analyzer report --input ./analyzed --questions ./questions.json --sdr "Jane Doe"

Advanced Usage

Filtering Examples

Filter by SDR and Date Range:

call-analyzer fetch \
  --sdr "John Smith" \
  --start-date 2025-10-01 \
  --end-date 2025-10-31 \
  --output ./results

Filter by Deal Stage:

call-analyzer fetch \
  --stage Discovery \
  --start-date 2025-10-01 \
  --end-date 2025-10-31 \
  --output ./results

Complete Workflow

# 1. Fetch transcripts
call-analyzer fetch \
  --start-date 2025-10-01 \
  --end-date 2025-10-31 \
  --output ./analysis

# 2. Analyze with questions
call-analyzer analyze \
  --input ./analysis/transcripts \
  --questions ./questions.json \
  --output ./analysis/analyzed

# 3. Generate report
call-analyzer report \
  --input ./analysis/analyzed \
  --questions ./questions.json

Logging

Logs are automatically stored in ./logs/ directory with daily rotation:

  • File: ./logs/call-analyzer-YYYY-MM-DD.log
  • Retention: 30 days
  • Format: JSON with timestamps, call IDs, and error details

Error Handling

The tool handles common errors gracefully:

  • Invalid API Keys: Clear error messages with setup instructions
  • Rate Limiting: Automatic prompts to continue, skip, or abort
  • Partial Failures: Continues processing remaining items and logs errors
  • Empty Results: Helpful messages when no data matches filters

Development

Build

npm run build

Run Tests

npm test

Lint

npm run lint
npm run lint:fix

Troubleshooting

No Transcripts Found

  • Check date range is correct
  • Verify SDR name spelling (case-sensitive)
  • Ensure API key has proper permissions

OpenAI Batch Timeout

  • Large batches (100+ calls) can take 30-60 minutes
  • Split into smaller batches if needed
  • Check OpenAI API usage and limits

Missing Configuration

  • Ensure .env file exists with API keys
  • Verify questions.json is properly formatted
  • Check file paths are correct

License

ISC

Support

For issues and questions, please check:

  • Configuration files (.env, questions.json)
  • Log files in ./logs/ directory
  • Close CRM and OpenAI API status

About

A Node.js command-line tool that fetches call transcripts from Close CRM, analyzes them using OpenAI ChatGPT batch processing, and generates summary reports with percentage breakdowns.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors