Automate Spotify Liked Songs Sync to Playlist with n8n
What You Will Learn
In this tutorial-style guide, you will learn how to use an n8n workflow template to automatically sync your Spotify Liked Songs with a specific playlist. By the end, you will understand:
- How the workflow runs on a schedule to keep your playlist updated
- How n8n fetches your liked songs and playlists from Spotify
- How the workflow compares two datasets to find songs to add or remove
- How to customize the target playlist, schedule, and notifications
This guide is ideal if you want a hands-free way to keep a Spotify playlist perfectly aligned with your Liked Songs.
Concept Overview: How the Workflow Works
Before we jump into the step-by-step instructions, it helps to understand the main idea behind the automation.
Core Idea
The n8n workflow runs at a regular interval (for example, every night at midnight). Each run does the following:
- Retrieves your current Liked Songs from Spotify
- Retrieves your Spotify playlists and identifies the target playlist
- Fetches the tracks currently in that target playlist
- Compares the liked songs with the playlist tracks
- Adds any liked songs that are missing from the playlist
- Removes any songs from the playlist that you no longer like
- Optionally sends a notification summarizing what changed
In other words, the playlist becomes a live mirror of your Liked Songs, updated automatically.
Key Components in n8n
The workflow is built from several types of nodes in n8n:
- Trigger node – starts the workflow on a schedule
- Set / Variable nodes – store configuration values like playlist name and start time
- Spotify nodes – interact with your Spotify account (fetch liked songs, playlists, and modify playlists)
- Filter / Comparison nodes – select the right playlist and compare datasets
- Loop / Operation nodes – add and remove tracks one by one
- Optional notification nodes – send a summary via Gotify
Step-by-Step: Inside the n8n Workflow Template
Now let us walk through each part of the workflow in the order it executes, explaining what each node does and how they work together.
Step 1 – Schedule the Workflow
The workflow starts with a Schedule Trigger node.
- What it does: Triggers the workflow automatically every 24 hours.
- Configured time: 0 o’clock (midnight), so your playlist is refreshed once per day.
You can change this later if you want a different interval or time of day.
Step 2 – Define the Target Playlist Name
Next, a variable is used to tell the workflow which playlist to sync.
- The workflow uses a variable called
varplaylistto. - Your task: Set
varplaylisttoto the exact name of the Spotify playlist you want to keep in sync with your Liked Songs.
This is usually done in an "Edit set Vars" or similar Set node inside n8n.
Step 3 – Initialize Timing Variables
To track performance, the workflow initializes an internal variable, often named timestart.
- Purpose: Store the start time of the workflow run.
- Benefit: Can be used later to measure how long the workflow took to complete.
This step does not affect the logic of syncing but is useful for monitoring and optimization.
Step 4 – Connect to Spotify and Fetch Data
The next group of nodes communicates with your Spotify account.
4.1 Fetch Liked Songs
- The workflow calls Spotify to retrieve all tracks you have liked.
- This dataset represents the source of truth for what should be in your synced playlist.
4.2 Fetch User Playlists
- Another Spotify node fetches all playlists in your account.
- These results are used to find the specific playlist whose name matches
varplaylistto.
Important: You must configure the Spotify nodes with your own Spotify account credentials in n8n so that the workflow can access your data. This is done by setting up a Spotify credential in n8n and selecting it in each Spotify node.
Step 5 – Filter to the Target Playlist
Once all playlists are fetched, the workflow needs to isolate the one you want to sync.
- A filter step checks each playlist name against the
varplaylisttovariable. - Only the playlist whose name matches your target value continues through the workflow.
This gives the workflow a single, specific playlist to work with.
Step 6 – Get Tracks from the Target Playlist
With the target playlist identified, the workflow then:
- Uses a Spotify node to retrieve all tracks currently in that playlist.
- Stores this list so it can be compared to your Liked Songs.
At this point, the workflow has two main datasets:
- All your Liked Songs
- All tracks in the target playlist
Step 7 – Prepare, Sort, and Merge Data
Before comparing, the workflow prepares the data for accurate matching.
- Both datasets are sorted, often by the date the songs were added.
- The workflow may normalize or structure fields so that each track can be matched consistently, typically using identifiers like track IDs.
- The data is then prepared for the Compare Datasets node, which expects a clear "left side" and "right side" to compare.
This preparation step ensures that the comparison results are reliable.
Step 8 – Compare Liked Songs with Playlist Tracks
The Compare Datasets node is the core logic that decides what to add or remove.
It checks:
- Tracks in Liked Songs but not in the playlist – these are the songs that need to be added.
- Tracks in the playlist but not in Liked Songs – these are the songs that should be deleted.
After this step, the workflow has two clean lists:
- Tracks to add to the playlist
- Tracks to remove from the playlist
Step 9 – Add Missing Songs to the Playlist
The workflow then processes the list of songs that are liked but not yet in the playlist.
- It loops through each missing track.
- For each track, a Spotify node calls the "add to playlist" API operation.
- The track is added to the target playlist automatically.
This loop continues until all missing liked songs have been added to the playlist.
Step 10 – Remove Songs That Are No Longer Liked
Next, the workflow handles the opposite case: songs that are in the playlist but no longer liked.
- It loops through every track in the "to delete" list.
- For each one, a Spotify node calls the "delete from playlist" API operation.
- The track is removed from the target playlist.
After this step, the playlist should match your current Liked Songs list.
Step 11 – Optional Notifications (Gotify)
Finally, the workflow can optionally send you a summary of what changed.
- Internal nodes count how many tracks were added and how many were deleted.
- A Gotify node can send a message that includes these counts.
This is useful if you want to keep an eye on the automation without opening n8n or Spotify every time.
How to Customize the n8n Spotify Sync Workflow
The template is ready to use, but you should adjust a few key settings to fit your needs.
1. Set Your Target Playlist Name
- Open the "Edit set Vars" (or similar) node in n8n.
- Find the variable
varplaylistto. - Enter the exact name of the Spotify playlist you want to sync with your Liked Songs.
2. Add Your Spotify Credentials
- In n8n, create or select a Spotify credential that connects to your account.
- Open each Spotify node in the workflow.
- Assign your Spotify credential under the account connection or authentication section.
Without this, the workflow cannot read your liked songs or modify your playlists.
3. Adjust the Schedule
- Open the Schedule Trigger node.
- Change the interval if you want the sync to run more or less frequently.
- You can also change the time of day if midnight is not ideal for you.
For example, you might run it every 6 hours, once a week, or at a specific time each evening.
Why Automate Spotify Playlist Sync with n8n?
Using this n8n workflow template to sync Spotify Liked Songs to a playlist has several advantages:
- Save time: No more manually adding every new liked song to your favorite playlist.
- Always up to date: Your chosen playlist stays in sync with your Liked Songs without effort.
- Full visibility: Optional notifications let you know how many songs were added or removed in each run.
- Flexible automation: Because it runs in n8n, you can extend it with extra steps, such as logging changes or triggering other workflows.
Quick Recap
Here is a brief summary of what the workflow does:
- Runs on a schedule using a Schedule Trigger.
- Uses
varplaylisttoto identify your target playlist. - Initializes timing variables like
timestartfor performance tracking. - Fetches your Liked Songs and user playlists from Spotify.
- Filters playlists to find the one matching
varplaylistto. - Gets all tracks from the target playlist.
- Sorts and prepares data, then uses Compare Datasets to find:
- Songs to add (liked but not in the playlist)
- Songs to delete (in the playlist but not liked)
- Adds missing songs with Spotify "add to playlist" operations.
- Removes old songs with Spotify "delete from playlist" operations.
- Optionally sends Gotify notifications with counts of added and deleted tracks.
FAQ
Do I need coding skills to use this n8n template?
No, you do not need to write code. You mainly configure nodes, fill in variables like varplaylistto, and connect your Spotify credentials. The template handles the logic for you.
Can I sync to more than one playlist?
This particular template focuses on one target playlist defined by varplaylistto. To sync multiple playlists, you could duplicate and adapt the workflow or extend it to handle multiple target playlists, but that would require additional configuration.
Will this delete songs from my Liked Songs?
No. The workflow only adds to or removes from the target playlist. Your Liked Songs remain the master list and are not modified by this automation.
Can I change how often the playlist is updated?
Yes. Open the Schedule Trigger node in n8n and adjust the frequency and time according to your preference.
Start Using the Template
If you want to automate your Spotify playlist management with n8n, this template is a practical starting point. After a brief setup, you will have a fully automated system that keeps your playlist aligned with your Liked Songs, so you can focus on enjoying your music instead of maintaining it.
Give it a try in your n8n instance and feel free to customize it further for your own workflows.
