An AI-powered assistant for migrating Podio data between organizations. Built with Next.js 15 and Vercel AI SDK v5, this tool uses GPT-4 with tool calling to perform large-scale data migrations, workspace structure cloning, and intelligent field mapping.
- Large-Scale Item Migration: Optimized for migrating 80,000+ items with intelligent batching (100-1000 items/batch) and rate limit handling
- Smart Duplicate Detection: Match items across apps using any text/number/email/calculation field to detect duplicates before creation
- Configurable Duplicate Handling: Skip duplicates, update existing items, or fail on conflicts - you choose the strategy
- Match Field Validation: Automatically validates that match fields are suitable for comparison (excludes complex types like app references, contacts, dates)
- Progress Tracking: Real-time monitoring with detailed statistics (processed, successful, failed, throughput, ETA)
- Error Recovery: Automatic retry logic with exponential backoff and detailed failure categorization
- Export/Import Tools: Backup items to JSON/NDJSON files or import from external sources with validation
- Cache Management: Intelligent app structure caching with automatic invalidation on field errors
- Workspace Structure Cloning: Clone spaces and apps with automatic field mapping generation
- Webhook Cloning: Duplicate webhooks to new apps with URL verification
- Globiflow Discovery: Document Globiflow workflows for manual recreation (no API available)
- Field Mapping: Automatic field mapping by external_id with support for custom mappings
- Field Type Filtering: Automatically excludes read-only fields (calculation, created_on, created_by, etc.) from target mappings
- Dry-Run Mode: Preview changes and validate data before executing migrations
- Node.js 18+ (for native FormData and fetch support)
- Podio Account with API credentials
- OpenAI API Key (for GPT-4)
# Clone the repository
git clone https://github.com/rdfitted/podiomigrationassistant.git
cd podiomigrationassistant
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.localCreate a .env.local file with the following variables:
# Required: OpenAI API Key for AI agent
OPENAI_API_KEY=sk-...
# Required: Podio API Credentials
PODIO_CLIENT_ID=your-client-id
PODIO_CLIENT_SECRET=your-client-secret
# Optional: Podio API Configuration
PODIO_API_BASE=https://api.podio.com # default-
Start the development server:
npm run dev
-
Authorize with Podio:
- Visit
http://localhost:3000/api/auth/podio/authorize - Complete OAuth flow to obtain access tokens
- Tokens are automatically managed and refreshed
- Visit
-
Access the application:
- Open
http://localhost:3000in your browser - Start using the AI-powered migration assistant
- Open
For migrating large datasets (80,000+ items) between apps:
// The AI agent handles this, but here's what happens under the hood:
1. Discovery Phase
- Analyze source and target app structures
- Generate automatic field mappings
- Validate field type compatibility
- Count total items to migrate
2. Migration Execution
- Batch processing (100-1000 items per batch, default: 500)
- Concurrent requests with rate limit handling (1-10 concurrent, default: 5)
- Smart duplicate detection via match fields
- Configurable duplicate behavior (skip/error/update)
- Progress tracking with real-time statistics
3. Validation
- Verify item counts (source vs target)
- Check data integrity with sample validation
- Review migration logs for errors
- Generate migration reportsUser: "Migrate all items from app 12345 to app 67890"
AI Agent:
- Analyzes both app structures
- Creates automatic field mapping (matching external_ids)
- Validates field type compatibility
- Executes migration in batches with progress updates
- Reports: total processed, successful, failed, throughput
User: "Migrate items from app 12345 to app 67890, but skip items that already exist based on 'Order Number' field"
AI Agent:
- Analyzes app structures
- Validates 'Order Number' field is suitable for matching (text/number/email/etc)
- Configures migration with:
- sourceMatchField: 'order-number' (external_id)
- targetMatchField: 'order-number' (external_id)
- duplicateBehavior: 'skip'
- Processes items, checking for duplicates before creation
- Reports: new items created, duplicates skipped
User: "Update items in app 67890 with data from app 12345, matching by 'Customer Email' field"
AI Agent:
- Sets up migration with:
- sourceMatchField: 'customer-email'
- targetMatchField: 'customer-email'
- duplicateBehavior: 'update'
- For each source item:
- Searches target app by email
- Updates matching item if found
- Creates new item if no match
- Reports: items updated, items created, items failed
User: "Import items from app 12345 to app 67890, but fail if any duplicates exist based on 'Invoice ID'"
AI Agent:
- Configures migration with:
- sourceMatchField: 'invoice-id'
- targetMatchField: 'invoice-id'
- duplicateBehavior: 'error'
- stopOnError: true (optional)
- Stops migration if duplicate detected
- Reports which item caused the duplicate error
User: "Export all items from app 12345 to a JSON file for backup"
AI Agent:
- Streams items in batches to avoid memory issues
- Writes to data/exports/app-12345.json
- Reports: total items exported, file path
User: "Import items from data/exports/app-12345.json to app 67890"
AI Agent:
- Validates JSON structure
- Performs dry-run validation (optional)
- Imports in batches
- Reports: processed, successful, failed
βββββββββββββββββββββββββββββββββββββββ
β Frontend Layer (React + AI SDK) β Chat interface, UI components
βββββββββββββββββββββββββββββββββββββββ€
β Agent Layer (AI Tool Calling) β GPT-4 with structured tools
βββββββββββββββββββββββββββββββββββββββ€
β Tool Layer (Migration Tools) β Podio operation abstractions
βββββββββββββββββββββββββββββββββββββββ€
β Migration Layer (Business Logic) β Planning, execution, state
βββββββββββββββββββββββββββββββββββββββ€
β Podio SDK Layer (API Client) β HTTP client, auth, resources
βββββββββββββββββββββββββββββββββββββββ
- Authentication System (
lib/podio/auth/): OAuth 2.0 with automatic token refresh - HTTP Client (
lib/podio/http/): Singleton client with retry logic and rate limiting - Migration Engine (
lib/migration/items/): Batch processor with error handling - State Management (
lib/migration/state-store.ts): Persistent migration job tracking - File Transfer (
lib/podio/resources/files.ts): Download, upload, and attachment handling
User Input β AI Agent β Tool Selection β Migration Planning
β
Batch Processing β Rate Limit Handling β Item Creation/Update
β
File Transfer β Progress Tracking β Completion Report
# Development server with Turbo
npm run dev
# Production build
npm run build
# Start production server
npm start
# Lint code
npm run lint
# Reconstruct failed items (utility)
npm run reconstruct-failedpodio-agent/
βββ app/ # Next.js 15 app directory
β βββ api/ # API routes
β β βββ agent/ # AI agent endpoint
β β βββ auth/ # OAuth endpoints
β β βββ migration/ # Migration API
β βββ components/ # React components
β βββ page.tsx # Main chat interface
βββ lib/
β βββ ai/ # AI SDK integration
β β βββ tools.ts # Tool definitions
β β βββ schemas/ # Zod schemas
β βββ migration/ # Migration logic
β β βββ items/ # Item migration
β β βββ state-store.ts # Job persistence
β β βββ logging.ts # Migration logs
β βββ podio/ # Podio SDK
β βββ auth/ # Authentication
β βββ http/ # HTTP client
β βββ resources/ # API resources
βββ data/ # Persistent data
β βββ migrations/ # Migration job state
βββ logs/ # Application logs
β βββ podio-token-cache.json # OAuth tokens
βββ aidocs/ # AI context documentation
- Match Field Selection: Use any compatible field type (text, number, email, calculation, phone, money, etc.)
- Field Validation: Automatically rejects incompatible match fields (app references, contacts, dates, files)
- Duplicate Strategies:
skip: Check for duplicates before creating, skip if existserror: Fail migration if duplicate detected (useful for data integrity)update: Update existing items instead of creating duplicates
- Performance: Prefetch cache for fast duplicate lookups (reduces API calls by 90%+)
- Logging: Detailed duplicate detection logs for troubleshooting
- Configurable batch sizes (100-1000 items, default: 500)
- Concurrent request handling (1-10 concurrent, default: 5)
- Automatic rate limit detection and pausing
- Memory-efficient streaming for large datasets (80,000+ items)
- Per-item retry with exponential backoff (max 3 attempts)
- Error categorization (rate limits, validation, API errors, duplicate conflicts)
- Failed item tracking with detailed error messages and context
- Partial success support (continue on errors or stop on first failure)
- Automatic cache clearing on field-not-found errors
- Real-time progress updates (processed, successful, failed, duplicates)
- Estimated time remaining (ETA)
- Throughput metrics (items/second, batches/minute)
- Detailed migration logs (JSON format at logs/migration.log)
- Per-migration state persistence (data/migrations/{jobId}.json)
Solution: Visit /api/auth/podio/authorize to reauthorize
Solution: The system automatically handles rate limits by pausing. If persistent, reduce concurrency or batch size.
Solution: Check that:
- Source items have files attached
- OAuth token has file access permissions
- Network connection is stable
Solution:
- Verify field types match between source and target
- Check for read-only fields (calculation, created_on, etc.)
- Use custom field mapping if auto-mapping fails
Solution:
- Verify match field exists in both apps with same external_id
- Check that match field type is compatible (text, number, email, etc.)
- Ensure match field contains unique values
- Review logs for "incompatible match field type" errors
Solution: The field type cannot be used for matching. Valid types include:
- text, number, email, calculation, phone, money, duration, location, question
- Invalid types: app (references), contact, date, file, image, embed, created_on, created_by
Solution:
- Use
clearAppCachetool via AI agent - Or call
DELETE /api/cache/{appId}REST endpoint - System auto-clears cache on field-not-found errors
- Migration Logs:
logs/migration.log- Structured JSON logs with duplicate detection details - Podio SDK Logs:
logs/podio-sdk.log- API call details - Job State:
data/migrations/{jobId}.json- Per-migration state with duplicate counts - Failed Items:
logs/failed-items-{jobId}.json- Detailed failure logs with match field values
Globiflow (Podio Workflow Automation) has no public API. While this tool can discover and document workflows, they must be manually recreated in target apps with field references updated.
- Maximum file size: 100MB per file (Podio limitation)
- Files are downloaded and re-uploaded (not copied directly)
- Large file migrations may be slow depending on network speed
- File transfer requires additional API calls (count toward rate limits)
Podio enforces API rate limits. The system automatically:
- Tracks remaining quota
- Pauses when approaching limits
- Resumes after reset
- Logs all rate limit events
This project uses:
- TypeScript for type safety
- ESLint for code quality
- Next.js 15 app router
- Vercel AI SDK v5 for agent functionality
- Zod for schema validation
Private repository. All rights reserved.
Built with β€οΈ using Claude Code