# Import-Workflows.ps1 # Script pour importer tous les workflows N8N automatiquement param( [string]$n8nUrl = "http://localhost:5678", [string]$apiKey = "" ) Write-Host "🚀 Importation des Workflows N8N pour Keep Notes MCP" -ForegroundColor Cyan Write-Host "=================================================" -ForegroundColor Cyan Write-Host "" # VĂ©rifier si N8N est accessible try { $response = Invoke-WebRequest -Uri "$n8nUrl/rest/workflows" -UseBasicParsing Write-Host "✅ N8N est accessible Ă  $n8nUrl" -ForegroundColor Green } catch { Write-Host "❌ Erreur: Impossible de connecter Ă  N8N Ă  $n8nUrl" -ForegroundColor Red Write-Host " VĂ©rifiez que N8N est en cours d'exĂ©cution" -ForegroundColor Yellow exit 1 } Write-Host "" # Liste des workflows Ă  importer $workflows = @( @{ file = "n8n-workflow-create-note.json" name = "Create Note with Classification" }, @{ file = "n8n-workflow-search-summary.json" name = "Search & Summary" }, @{ file = "n8n-workflow-notebook-management.json" name = "Notebook Manager" }, @{ file = "n8n-workflow-reminder-notifications.json" name = "Reminder Notifications" }, @{ file = "n8n-workflow-label-management.json" name = "Label Manager" }, @{ file = "n8n-workflow-email-integration.json" name = "Email to Note" } ) $imported = 0 $failed = 0 foreach ($workflow in $workflows) { $filePath = $workflow.file $name = $workflow.name Write-Host "đŸ“„ Importation: $name" -ForegroundColor Yellow if (-not (Test-Path $filePath)) { Write-Host " ❌ Fichier non trouvĂ©: $filePath" -ForegroundColor Red $failed++ continue } try { # Lire le fichier JSON $workflowJson = Get-Content $filePath -Raw # PrĂ©parer les en-tĂȘtes $headers = @{ "Content-Type" = "application/json" } if ($apiKey) { $headers["Authorization"] = "Bearer $apiKey" } # Envoyer Ă  N8N $response = Invoke-RestMethod ` -Uri "$n8nUrl/rest/workflows/import" ` -Method POST ` -Body $workflowJson ` -Headers $headers ` -ErrorAction Stop Write-Host " ✅ ImportĂ© avec succĂšs (ID: $($response.id))" -ForegroundColor Green $imported++ } catch { Write-Host " ❌ Erreur lors de l'import: $_" -ForegroundColor Red $failed++ } Write-Host "" } # RĂ©sumĂ© Write-Host "=================================================" -ForegroundColor Cyan Write-Host "📊 RĂ©sumĂ© de l'importation" -ForegroundColor Cyan Write-Host "=================================================" -ForegroundColor Cyan Write-Host "" Write-Host "✅ ImportĂ©s avec succĂšs: $imported" -ForegroundColor Green Write-Host "❌ Échecs: $failed" -ForegroundColor Red Write-Host "📝 Total: $($workflows.Count)" -ForegroundColor Yellow Write-Host "" if ($imported -gt 0) { Write-Host "🎉 Importation terminĂ©e!" -ForegroundColor Green Write-Host "" Write-Host "📌 Prochaines Ă©tapes:" -ForegroundColor Yellow Write-Host " 1. Ouvrez N8N dans votre navigateur" -ForegroundColor White Write-Host " 2. Configurez les variables d'environnement (Settings → Variables)" -ForegroundColor White Write-Host " 3. Configurez les connexions (Slack, Email, OpenAI)" -ForegroundColor White Write-Host " 4. Activez les workflows (bouton play)" -ForegroundColor White Write-Host "" Write-Host "📚 Documentation: N8N-SETUP.md" -ForegroundColor Cyan } else { Write-Host "⚠ Aucun workflow n'a pu ĂȘtre importĂ©" -ForegroundColor Yellow Write-Host "Consultez la documentation N8N-SETUP.md pour plus d'informations" -ForegroundColor Cyan } Write-Host ""