Skip to content

leemingee/iWatcherPartner

Repository files navigation

iWatcher - Automated Audio Transcription Pipeline

Fully automated audio transcription workflow using n8n, AssemblyAI, and OpenAI GPT-5. Upload audio to Google Drive and get AI-powered transcriptions with speaker diarization in Notion + Google Drive.

πŸš€ Features

  • πŸŽ™οΈ Speaker Diarization - Identifies who said what with timestamps
  • πŸ€– AI Processing - GPT-5 powered summaries and key insights
  • πŸ“Š Dual Output - Saves to both Notion database and Google Drive
  • ⚑ Auto-Triggered - Processes new files automatically (checks every minute)
  • πŸ”„ Smart Chunking - Splits long content into Notion-friendly 2000-char blocks
  • πŸ›‘οΈ Error Handling - Continues processing even if OpenAI fails
  • ☁️ Cloud Deployment - Runs 24/7 on AWS (no local computer needed)

πŸ“‹ Quick Start

Local Development

# 1. Clone repository
git clone <your-repo>
cd iWatcherPartner

# 2. Copy environment template
cp .env.example .env

# 3. Add your API keys to .env
# - ASSEMBLYAI_API_KEY
# - OPENAI_API_KEY
# - NOTION_API_TOKEN
# - NOTION_DATABASE_ID

# 4. Start local n8n (requires Docker)
docker-compose up -d

# 5. Access n8n UI
open http://localhost:5678

# 6. Import workflow
python3 import-workflow.py

# 7. Configure Google Drive OAuth in n8n UI
# Settings β†’ Credentials β†’ Add Google Drive OAuth2 API

AWS Deployment

πŸ“˜ Complete Step-by-Step Guide: See docs/COMPLETE-DEPLOYMENT-GUIDE.md

This guide covers everything:

  • AWS infrastructure setup
  • n8n container configuration
  • Workflow import
  • Google OAuth setup (with SSM tunnel trick)
  • HTTPS setup with custom domain
  • Complete testing and verification

Quick deploy (if you know what you're doing):

cd infrastructure
npm install
NOTIFICATION_PHONE_NUMBER="+1234567890" npx cdk deploy SimpleIWatcherStack

For HTTPS setup: docs/HTTPS-DOMAIN-SETUP.md

πŸ—οΈ Architecture

Google Drive "New" Folder
         ↓
    [n8n Trigger]
         ↓
  Download Audio
         ↓
   AssemblyAI API
  (Speaker Diarization)
         ↓
    OpenAI GPT-5
  (AI Summary) ← [Error Handling]
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
   ↓             ↓
Notion DB    Google Drive
(Chunked)   (Full .txt)
   ↓
Move to "Completed"

πŸ“¦ Project Structure

iWatcherPartner/
β”œβ”€β”€ iwatcher-gdrive-trigger.json    # Main n8n workflow
β”œβ”€β”€ import-workflow.py              # Workflow deployment script
β”œβ”€β”€ google_credentials.json         # Google OAuth (keep secure!)
β”œβ”€β”€ .env.example                    # Environment template
β”œβ”€β”€ infrastructure/                 # AWS CDK deployment
β”‚   β”œβ”€β”€ lib/                        # CDK stack definitions
β”‚   β”œβ”€β”€ n8n-workflows/              # Workflow backups
β”‚   └── cdk-app.ts                  # Main CDK app
└── docs/                           # Documentation
    β”œβ”€β”€ AWS-DEPLOYMENT-PLAN.md      # AWS deployment guide
    └── WORKFLOW-SUMMARY.md         # Workflow documentation

πŸ”‘ Required API Keys

1. AssemblyAI (Transcription)

2. OpenAI (AI Processing)

3. Notion (Database Storage)

4. Google Drive OAuth

  • Create project: https://console.cloud.google.com
  • Enable Google Drive API
  • Create OAuth 2.0 credentials (Desktop app)
  • Download google_credentials.json
  • Cost: Free

βš™οΈ Workflow Configuration

Key Features

1. Google Drive Trigger

  • Monitors "New" folder every minute
  • Detects new audio files automatically

2. Speaker Diarization

  • Identifies multiple speakers
  • Adds timestamps to each utterance
  • Format: [MM:SS] Speaker A: text

3. OpenAI Processing

  • Model: gpt-5-2025-08-07
  • No token limits (uses default 128K)
  • Error handling: Falls back if API fails

4. Dual Delivery

  • Notion: Chunked into 2000-char blocks
  • Google Drive: Full transcript as .txt

5. File Management

  • Success: Moves to "Completed" folder
  • Failure: Moves to "Failed" folder

πŸ”§ Environment Variables

Create .env file:

# AssemblyAI
ASSEMBLYAI_API_KEY=your_key_here

# OpenAI
OPENAI_API_KEY=sk-proj-...

# Notion
NOTION_API_TOKEN=ntn_...
NOTION_DATABASE_ID=your_database_id

# Google Drive (folder IDs)
GOOGLE_DRIVE_NEW_FOLDER_ID=...
GOOGLE_DRIVE_COMPLETED_FOLDER_ID=...
GOOGLE_DRIVE_FAILED_FOLDER_ID=...

πŸ“ Usage

1. Upload Audio

  • Drop audio file into Google Drive "New" folder
  • Supported formats: M4A, MP3, WAV, AAC

2. Wait for Processing

  • Workflow triggers within 1 minute
  • Transcription takes ~3-10 minutes
  • Check Notion database for results

3. View Results

  • Notion: AI summary + chunked transcript
  • Google Drive "Completed": Full transcript with metadata
  • Original audio: Moved to "Completed" folder

🎯 Deployment Options

Option 1: Local Docker (Development)

  • Cost: $0
  • Setup time: 15 minutes
  • Use case: Testing, development

Option 2: AWS EC2 Simple (Testing)

  • Cost: ~$17/month
  • Setup time: 30 minutes
  • Use case: Single-user testing

Option 3: AWS ECS (Production) ⭐ Recommended

πŸ› οΈ Troubleshooting

Workflow Not Triggering

# Check n8n logs
docker logs iwatcher-n8n --tail 50

# Verify workflow is active
curl -H "X-N8N-API-KEY: your_key" \
  http://localhost:5678/api/v1/workflows

Google OAuth Issues

  • Delete credential and recreate
  • Ensure redirect URI is http://localhost:5678/rest/oauth2-credential/callback
  • Check Google Cloud Console for authorized redirect URIs

OpenAI Errors

  • Workflow continues even if OpenAI fails
  • Check fallback summary in output
  • Verify API key and quotas

πŸ“Š Cost Estimates

Monthly costs for 40 hours of audio:

  • AssemblyAI: ~$15 (40 hours Γ— $0.37)
  • OpenAI: ~$2 (40 transcripts Γ— $0.05)
  • AWS (Production): ~$88/month
  • Total: ~$105/month

Free tier options:

  • Notion: Free
  • Google Drive: Free (15GB)

πŸ” Security

  • Credentials: Stored in .env and google_credentials.json (gitignored)
  • AWS: Uses Secrets Manager for API keys
  • n8n: Encrypted credential storage
  • HTTPS: Recommended for production (see domain setup)

πŸ“š Documentation

For Deployment

For Understanding

Helper Scripts

  • setup.py - Import workflow and verify environment
  • test-complete-pipeline.py - End-to-end testing and monitoring
  • import-workflow.py - Basic workflow import utility

🀝 Contributing

  1. Fork the repository
  2. Create feature branch
  3. Test changes locally
  4. Submit pull request

πŸ“„ License

MIT License - see LICENSE file for details

πŸ™‹ Support

For issues and questions:

  1. Check Troubleshooting section
  2. Review docs/ folder
  3. Open GitHub issue

Ready to start? Follow the Quick Start guide above!

About

iWatcherPartner works with iWatcher Recorder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •