Eine umfassende Anleitung zum Erstellen eines bidirektionalen Spotify Playlist Sync Workflows mit n8n. Synchronisiere zwei Playlisten automatisch, ohne Duplikate und mit intelligenter Deduplication!
Die vollständige, interaktive Dokumentation findest du hier:
Importiere den vorbereiteten Workflow direkt in deine n8n Instanz:
Kopiere diese URL in n8n (Workflows → Import from URL):
https://raw.githubusercontent.com/Assassins88/spotify-playlist-sync/main/spotify-playlist-sync.workflow.json
oder öffne diese URL direkt:
https://app.n8n.io/workflows?import=https://raw.githubusercontent.com/Assassins88/spotify-playlist-sync/main/spotify-playlist-sync.workflow.json
Nach dem Import:
- Ersetze
YOUR_SPOTIFY_CREDENTIAL_IDmit deinen echten Spotify Credentials - Ersetze
YOUR_PLAYLIST_1_IDundYOUR_PLAYLIST_2_IDmit deinen Playlist IDs - Passe die Track-Anzahl im Code Node an (split1 & split2)
- Teste und deploye! 🎉
- ✅ Synchronisiert zwei Spotify Playlisten bidirektional
- ✅ Verhindert Duplikate automatisch
- ✅ Filtert lokale Tracks (können nicht hochgeladen werden)
- ✅ Kann manuell oder per Schedule ausgelöst werden
- ✅ Funktioniert mit großen Playlisten (>100 Tracks)
- n8n (selbst-gehostet oder n8n.cloud)
- Spotify Developer Account (kostenlos)
- Spotify API Credentials (Client ID & Secret)
- Zwei Spotify Playlisten zum Synchronisieren
- Gehe zu developer.spotify.com/dashboard
- Melde dich an oder registriere dich
- Erstelle eine neue App
- Kopiere Client ID und Client Secret
- Registriere Redirect URI:
https://n8n.io/oauth2-credential/callback(oder deine n8n Domain)
- Gehe zu Credentials in n8n
- Erstelle neue Spotify OAuth2 Credentials
- Gib Client ID und Secret ein
- Authentifiziere dich mit Spotify (mit deinem Account)
- Stelle sicher, dass diese Scopes aktiv sind:
playlist-modify-publicplaylist-modify-privateplaylist-read-private
- Öffne deine Playlist in Spotify
- Klick auf "Teilen" → "Link kopieren"
- Der Link sieht so aus:
https://open.spotify.com/playlist/3cEYpjA9oz9GiPac4AsH4n - Die ID nach "playlist/" ist deine Playlist ID
Siehe oben "One-Click Import" - danach nur noch IDs anpassen!
Trigger (Manual/Cron)
↓
├─→ Get Playlist 1 Tracks
├─→ Get Playlist 2 Tracks
↓
Merge Node (kombiniert beide)
↓
Code Node (vergleicht & filtert)
↓
├─→ Add Tracks to Playlist 1
└─→ Add Tracks to Playlist 2
Der Code Node macht das Heavy Lifting:
// Extrahiert URIs aus beiden Playlisten
// Vergleicht sie und findet Unterschiede
// Filtert lokale Tracks (spotify:local:...)
// Gibt Arrays mit hinzuzufügenden Tracks zurück
const tracksToAddToP1 = [...]; // Fehlend in P1
const tracksToAddToP2 = [...]; // Fehlend in P2Wichtig: Lokale Tracks können NICHT via API hochgeladen werden. Sie werden automatisch gefiltert.
Im Code Node, passe diese Werte an deine Playlisten an:
const split1 = 100; // Anzahl Tracks in Playlist 1
const split2 = 150; // Anzahl Tracks in Playlist 2Diese Werte sagen dem Node, wo die erste Playlist endet und die zweite beginnt (nach Merge).
✅ Do's:
- Teste den Workflow zuerst mit kleinen Test-Playlisten
- Nutze die n8n Inspector-Seiteleiste zum Debuggen
- Aktiviere Logging mit
console.log()in Code Nodes - Beachte Spotify API Rate Limits (füge Wait Nodes zwischen Requests ein)
- Verwende Token Refresh (n8n macht das automatisch)
❌ Don'ts:
- Keine lokalen Tracks hochladen (werden automatisch gefiltert)
- Nicht zu häufig synchronisieren (beachte Rate Limits)
- Keine Credentials hardcoden
- Nicht alle Scopes entfernen
| Fehler | Lösung |
|---|---|
| "Invalid Spotify ID" | Playlist ID überprüfen (keine Query-Parameter) |
| "Insufficient permissions" | Credentials neu erstellen mit allen Scopes |
| "Token expired" | Credentials neu authentifizieren |
| "Rate limit exceeded" | Wait Node einfügen, Batch Size reduzieren |
| "Empty playlist returned" | "Get all" Checkbox im Spotify Node aktivieren |
Siehe die vollständige Dokumentation für mehr Details: Troubleshooting Guide
| Limit | Wert |
|---|---|
| Max Tracks pro Request | 100 URIs |
| Max Items pro Abruf | 50 (Standard) |
| Rate Limit | 429 Too Many Requests |
| Token Gültigkeit | 1 Stunde |
spotify-playlist-sync/
├── index.html # Interaktive Dokumentation
├── spotify-playlist-sync.workflow.json # n8n Workflow (importierbar)
├── README.md # Diese Datei
└── LICENSE # MIT License
Dieses Projekt ist ein Tutorial für n8n und Spotify API.
Wichtig:
- Respektiere die Spotify API Nutzungsbedingungen
- Nutze deine Credentials sicher und teile sie nicht
- Beachte Rate Limits um Blacklisting zu vermeiden
- Der exportierte Workflow enthält keine echten Credentials (nur Platzhalter)
Fehler gefunden? Verbesserungsvorschläge?
- GitHub Issues öffnen
- Pull Requests sind willkommen
- Feedback erwünscht!
Made with ❤️ für Spotify + n8n Enthusiasten 🎵
Viel Erfolg mit deinem Playlist Sync Workflow!
A comprehensive guide to creating a bidirectional Spotify Playlist Sync workflow with n8n. Synchronize two playlists automatically, without duplicates and with intelligent deduplication!
Find the complete, interactive documentation here:
Import the prepared workflow directly into your n8n instance:
Copy this URL in n8n (Workflows → Import from URL):
https://raw.githubusercontent.com/Assassins88/spotify-playlist-sync/main/spotify-playlist-sync.workflow.json
or open this URL directly:
https://app.n8n.io/workflows?import=https://raw.githubusercontent.com/Assassins88/spotify-playlist-sync/main/spotify-playlist-sync.workflow.json
After Import:
- Replace
YOUR_SPOTIFY_CREDENTIAL_IDwith your actual Spotify Credentials - Replace
YOUR_PLAYLIST_1_IDandYOUR_PLAYLIST_2_IDwith your playlist IDs - Adjust the track count in the Code Node (split1 & split2)
- Test and deploy! 🎉
- ✅ Synchronizes two Spotify playlists bidirectionally
- ✅ Prevents duplicates automatically
- ✅ Filters local tracks (cannot be uploaded)
- ✅ Can be triggered manually or via schedule
- ✅ Works with large playlists (>100 tracks)
- n8n (self-hosted or n8n.cloud)
- Spotify Developer Account (free)
- Spotify API Credentials (Client ID & Secret)
- Two Spotify playlists to synchronize
- Go to developer.spotify.com/dashboard
- Sign in or create an account
- Create a new app
- Copy Client ID and Client Secret
- Register Redirect URI:
https://n8n.io/oauth2-credential/callback(or your n8n domain)
- Go to Credentials in n8n
- Create new Spotify OAuth2 Credentials
- Enter Client ID and Secret
- Authenticate with Spotify (using your account)
- Make sure these scopes are active:
playlist-modify-publicplaylist-modify-privateplaylist-read-private
- Open your playlist in Spotify
- Click "Share" → "Copy Link"
- The link looks like:
https://open.spotify.com/playlist/3cEYpjA9oz9GiPac4AsH4n - The ID after "playlist/" is your playlist ID
See "One-Click Import" above - then just adjust the IDs!
Trigger (Manual/Cron)
↓
├─→ Get Playlist 1 Tracks
├─→ Get Playlist 2 Tracks
↓
Merge Node (combines both)
↓
Code Node (compares & filters)
↓
├─→ Add Tracks to Playlist 1
└─→ Add Tracks to Playlist 2
The Code Node does the heavy lifting:
// Extracts URIs from both playlists
// Compares them and finds differences
// Filters out local tracks (spotify:local:...)
// Returns arrays with tracks to add
const tracksToAddToP1 = [...]; // Missing in P1
const tracksToAddToP2 = [...]; // Missing in P2Important: Local tracks CANNOT be uploaded via API. They are automatically filtered.
In the Code Node, adjust these values for your playlists:
const split1 = 100; // Number of tracks in Playlist 1
const split2 = 150; // Number of tracks in Playlist 2These values tell the node where the first playlist ends and the second begins (after merge).
✅ Do's:
- Test the workflow first with small test playlists
- Use the n8n Inspector sidebar for debugging
- Enable logging with
console.log()in Code Nodes - Respect Spotify API Rate Limits (add Wait Nodes between requests)
- Use Token Refresh (n8n handles this automatically)
❌ Don'ts:
- Don't upload local tracks (automatically filtered)
- Don't synchronize too frequently (respect rate limits)
- Don't hardcode credentials
- Don't remove all scopes
| Error | Solution |
|---|---|
| "Invalid Spotify ID" | Check playlist ID (no query parameters) |
| "Insufficient permissions" | Recreate credentials with all scopes |
| "Token expired" | Re-authenticate credentials |
| "Rate limit exceeded" | Add Wait Node, reduce batch size |
| "Empty playlist returned" | Check "Get all" checkbox in Spotify Node |
See the full documentation for more details: Troubleshooting Guide
| Limit | Value |
|---|---|
| Max Tracks per Request | 100 URIs |
| Max Items per Retrieval | 50 (Standard) |
| Rate Limit | 429 Too Many Requests |
| Token Validity | 1 Hour |
spotify-playlist-sync/
├── index.html # Interactive Documentation
├── spotify-playlist-sync.workflow.json # n8n Workflow (importable)
├── README.md # This File
└── LICENSE # MIT License
This project is a tutorial for n8n and Spotify API.
Important:
- Respect Spotify API Terms of Service
- Keep your credentials safe and don't share them
- Respect Rate Limits to avoid blacklisting
- The exported workflow contains no real credentials (only placeholders)
Found a bug? Have suggestions?
- Open GitHub Issues
- Pull Requests Welcome
- Feedback appreciated!
Made with ❤️ for Spotify + n8n Enthusiasts 🎵
Good luck with your Playlist Sync Workflow!