Animated data flow diagram

AI-Powered Spotify Playlist Curator & Archiver

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

Spotify Google Sheets Anthropic Claude

Overview

Unlock Automated Music Curation & Archiving with this AI Agent

This n8n workflow acts as your personal AI DJ assistant, designed for Spotify users who want to systematically archive their listening history and effortlessly organize tracks. It automates the monthly (or scheduled) process of:

  1. Fetching your newly liked Spotify tracks.
  2. Archiving comprehensive track details (including metadata like artist, album, popularity, and audio features like danceability, energy) into a Google Sheet.
  3. Retrieving your existing Spotify playlists and their descriptions (also logged to Google Sheets).
  4. Leveraging an Anthropic Claude model to intelligently understand your playlist themes based on their names and descriptions, and analyze the characteristics of your new tracks.
  5. Classifying new tracks and automatically adding them in bulk to all relevant Spotify playlists.

This AI-driven automation saves you significant time and effort in maintaining a well-organized music library and a historical record of your listening habits.

Key Features & Benefits

  • Automated Track Discovery & Archival: Fetches new Spotify liked tracks on a schedule (default: monthly) and logs them with rich details in Google Sheets.
  • Intelligent AI Playlist Classification: Utilizes Anthropic Claude to analyze track characteristics (title, artist, audio features) and your existing playlist descriptions to assign tracks to the most suitable playlists.
  • Multi-Playlist Assignment: A single track can be intelligently added to multiple relevant playlists based on AI analysis.
  • Bulk Playlist Updates: Efficiently adds batches of classified tracks (up to 100 per request) to Spotify playlists.
  • Deduplication Logic: Prevents re-archiving or re-classifying tracks and playlists already processed and logged in Google Sheets.
  • Detailed Data Collection: Gathers track name, artist, album, Spotify URI & ID, external URLs, popularity, release year, and various audio features (danceability, energy, tempo, key, etc.).
  • Customizable AI Prompts: The core AI logic is driven by a detailed prompt in the 'Basic LLM Chain - AI Classification' node, which you can tailor to refine classification based on your specific playlist organization style and preferences.
  • Batch Processing: Optimizes API calls to Spotify and the Anthropic AI model for efficiency, processing tracks in chunks.
  • Comprehensive Logging: Maintains records of processed tracks and playlists in designated Google Sheets for transparency and historical data.

Use Cases

  • Automatically maintain a detailed, queryable archive of your Spotify listening history and track features in Google Sheets.
  • Effortlessly organize newly liked songs into genre, mood, or activity-based Spotify playlists without manual sorting.
  • Save hours curating music by letting an AI assistant understand your taste and manage playlist additions.
  • Keep your Spotify playlists fresh and relevant by consistently adding new music based on defined themes.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • Spotify OAuth2 credentials configured in n8n.
  • Google Sheets OAuth2 credentials configured in n8n.
  • Anthropic API Key with access to a suitable Claude model (e.g., Claude 3.5 Sonnet, as referenced in workflow notes). Note: AI model usage will incur costs based on Anthropic's pricing.
  • Two Google Sheets: one for logging track details (e.g., named 'tracks listing') and one for logging playlist details (e.g., named 'playlists listing').
  • Existing Spotify playlists with clear, descriptive names and detailed descriptions. The AI heavily relies on these descriptions to make accurate classifications.

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Configure Spotify Credentials: In the 'Get Playlist', 'Get Tracks', and 'Spotify' (playlist update) nodes, select your configured Spotify OAuth2 credentials.
  4. Configure Google Sheets Credentials & Sheets: In the 'Get logged tracks', 'Get logged playlists', 'Log new tracks', and 'Log new playlists' nodes, select your Google Sheets OAuth2 credentials. Update the 'Document ID' and 'Sheet Name' parameters to point to your prepared Google Sheets.
  5. Configure Anthropic Credentials: In the 'Anthropic Chat Model' node, select or create your Anthropic API credentials.
  6. Review AI Prompt & Playlist Logic:
    • Examine the 'Filter my playlist' node to ensure it correctly identifies your playlists (e.g., by owner.display_name).
    • Crucially, review the system prompt in the 'Basic LLM Chain - AI Classification' node. This prompt instructs the AI. Pay attention to how it ingests playlist information {{ JSON.stringify($('Playlists informations').all()) }}. The quality of your playlist names and descriptions (fetched by the 'Playlists informations' node) directly impacts AI performance.
    • Refer to the 'Sticky Note6' (Playlists' Description Examples) in the workflow canvas for guidance on crafting effective playlist descriptions.
  7. Review Output Parsing: Check the 'Structured Output Parser' node. Its schema defines how the AI's response is structured for adding tracks to playlists. Ensure it aligns with your needs if you modify the AI prompt significantly.
  8. Set Trigger: Adjust the 'Monthly Trigger' node if you prefer a different schedule (e.g., weekly, daily), or run it manually for initial setup and testing.
  9. Test: Run the workflow with a small number of tracks initially to verify all connections and logic.
  10. Activate the workflow for ongoing automated music curation.

Tags:

AI AgentSpotify AutomationMusic CurationAnthropic ClaudeGoogle SheetsProductivityPersonal AutomationAI-driven automation

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation