Expected Reading Time: 7 minutes
Do you know this? Sometimes you just fancy some mixed music. Your favorite songs from different genres or decades in one playlist. Unfortunately, you can't play playlist folders on your smartphone, only individual playlists. It's different on a PC, but who always has their computer with them?
The solution is simple: create a playlist that combines all your desired playlists and keep it up to date automatically. In this tutorial, I'll show you how to do just that with the help of n8n.
For detailed instructions and an explanation of all configuration options, I recommend the YouTube video linked below. In this video, every single setting is explained in detail so that you receive comprehensive instructions for the exact setup. You can find any code from the video in this article so that you can use it directly without having to type it in.
What is n8n?
n8n is an open source workflow automation platform that allows you to connect different services and applications and create automated workflows without the need for programming. With n8n, you can create complex workflows that are precisely tailored to your needs. This means you can retrieve data from one service, process it and send it to another service, all automated and without manual intervention.
n8n stands for "nodemation" and it works in a similar way to well-known tools such as Zapier or Integromat, but offers more flexibility and customization options. A big advantage of n8n is that it is available for free as open source software. You can host it on your own server or use a cloud service, which gives you full control over your data and workflows.
In addition, n8n offers a user-friendly, visual interface where you can add and connect nodes (the individual steps of your workflow) via drag-and-drop. Each node can perform a specific action, such as retrieving data, sending emails or updating a database. The ability to use conditions and loops allows you to design your workflows in a very detailed and precise way.
The community around n8n is constantly growing and offers a variety of ready-made workflows and integrations for numerous services such as Google Sheets, Slack, GitHub and even Spotify. This makes it easy for you to get started right away and create your own automated processes that make your everyday life easier and increase your productivity.
Background idea of automation
The real benefit of automation with n8n lies in facilitating and optimizing your music experience. Imagine you have a multitude of playlists on Spotify, all covering different moods, genres or decades. However, sometimes you don't want to constantly switch between these playlists, but simply have all your favorite songs in a single, shuffled playlist. This is exactly where automation comes into play.
With n8n, you can create a central playlist that combines all the songs from your various playlists and keeps them up to date at all times. This automation not only saves you time, but also ensures that you always have the latest and greatest songs in your central playlist. By automatically filtering duplicate tracks, the workflow also keeps your playlist clear and free of unnecessary repetitions.
Automation brings structure and efficiency to your music collection. You no longer have to worry about manually adding new songs or removing duplicate tracks. Instead, you can sit back, relax and enjoy your music while n8n does the work for you in the background. This solution is particularly useful if you regularly discover new music or frequently update your playlists. So you always have a perfectly maintained and up-to-date all-in-one playlist at your fingertips.
Step-by-step instructions for creating the workflow
1. preparation
Before you get started, you need a few things:
- One Spotify account
- An n8n account (you can either host it yourself or use a cloud service)
- A list of your playlists that you would like to combine
2. create a new workflow in n8n
After you have logged in to n8n, create a new workflow. Click on the "New Workflow" button and give your workflow a name, e.g. "Spotify: All in One Playlist". Then copy the template completely from the section Template.
3. create a new playlist in your Spotify account
Create a new playlist and name it as you wish. The default name in the workflow is Everything
. If you choose a different name, make sure that you use the Result filter
-node output with the name of your playlist, which should contain all songs.
4. adjust the filter according to your playlist names
Enter the exact names of the playlists you would like to have in your shared playlist with all songs in the filters Annual filter
and Misc filter
in. If you don't want to use so many playlists, you can also simply delete a path after the filter and use the Merge all Playlist Tracks
-Remove append node.
5. create your Spotify credentials and update each Spotify node with your credentials
Follow the instructions in the n8n documentationto create your Spotify access data for a developer account. Then select the access data in the nodes Get User's Playlists
, Get Playlist Tracks1
, Get Playlist Tracks2
, Get Playlist Tracks3
and Add tracks to common playlist
from.
6. activate the workflow in order to start the workflow based on the Schedule
-trigger node to execute a cron expression.
To ensure that your combined playlist is always up to date, you can use the Schedule
-trigger node. This node ensures that your workflow is executed at regular intervals (e.g. daily or weekly).
![Anker SoundCore 2 Bluetooth Speaker, Enormous with Dual Bass Drivers, 24h Battery, Enhanced IPX7 Waterproof, Wireless, for iPhone, galaxy etc.(Black)](https://m.media-amazon.com/images/I/31VTgJvzikL._SL160_.jpg)
![Anker Soundcore mini Bluetooth speaker with 15 hours playtime, fantastic sound, 20 meter Bluetooth range, FM radio and intense bass(Black)](https://m.media-amazon.com/images/I/41Up-32iNOL._SL160_.jpg)
![RIENOK Bluetooth Speaker with Light Bluetooth 5.3 Music Box Bass Wireless Speaker with IPX7 Waterproof Stereo Sound Portable](https://m.media-amazon.com/images/I/51FDZcnN++L._SL160_.jpg)
Template for Spotify: All in One Playlist
![Spotify All in One Playlist Workflow](https://i0.wp.com/sascha-brockel.de/wp-content/uploads/2024/06/Spotify-All-in-One.jpg?resize=750%2C403&ssl=1)
{
"name": "Spotify: All in One Playlist",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * * *"
}
]
}
},
"id": "fc0fb2a7-2b19-4802-a95c-aeeb9c3a31da",
"name": "CRON",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
180,
1020
],
"notesInFlow": true,
"typeVersion": 1.1,
"notes": "Every Day @ 9:00am"
},
{
"parameters": {
"resource": "playlist",
"operation": "getUserPlaylists",
"returnAll": true
},
"id": "a639129c-3f47-4935-936c-8e52568b3a11",
"name": "Get User's Playlists",
"type": "n8n-nodes-base.spotify",
"position": [
360,
1020
],
"typeVersion": 1,
"credentials": {
"spotifyOAuth2Api": {
"id": "",
"name": "Placeholder"
}
}
},
{
"parameters": {
"content": "## README\n\nThis workflow will automatically put all of your in filters specified Spotify playlists to one common separate playlist. One additional caveat this workflow addresses is it will compare the refreshed self-defined playlists tracks against your common playlist's existing tracks to ensure only unique tracks are added to your archive playlist. This helps reduce clutter within the common playlist. \n\n### Setup Instructions (Required)\n1. **Within your Spotify account, create a new playlist**\n You may name this playlist whatever you like. The default name within the workflow is `Everything`. If you decide on another name, ensure you update the `Result filter` node output with the name of your playlist that should contain all songs.\n\n2. **Change the filter according to your playlist names**\n You need to enter the exact playlist names you want to include your common playlist with all songs in the filter `Jahresfilter` and `Misc filter`. If you don't want to use so many playlists you can also easily delete one path after the filter and also remove the `Merge all Playlist Tracks` append node.\n\n3. **Create your Spotify credential(s) and update each Spotify node with your created credential**\n Follow the instructions within the [n8n docs](https://docs.n8n.io/integrations/builtin/credentials/spotify/) to create your Spotify credential, then select the credential in the `Get User's Playlists`, `Get Playlist Tracks1`, `Get Playlist Tracks2`, `Get Playlist Tracks3` and `Add tracks to common playlist` nodes.\n\n4. **Activate the workflow to run workflow based on the Cron expression set in the `Schedule` trigger node.**\n\n### Optional Setup\n- Update the Cron expression within the `Schedule` trigger node with an earlier or later time if your `GENERIC_TIMEZONE` is set. You may also consider setting the workflow timezone as well. For assistance with Cron expressions, refer to the [n8n docs](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger/#generate-a-custom-cron-expression).\n- Add nodes to the end of the workflow to send notifications, update a spreadsheet, or any other operation/action you'd like to perform in conjunction with archiving your Discover Weekly tracks\n- Setup an error workflow to handle any thing that goes wrong within the workflow. You can find an example [here](https://n8n.io/workflows/696-send-email-via-gmail-on-workflow-error/) or more information concerning handling errors within the [n8n docs](https://docs.n8n.io/courses/level-two/chapter-4/).\n",
"height": 809.5392255078667,
"width": 605.1751740139206,
"color": 4
},
"id": "aae7b263-e7b7-49ae-8e04-cf37dbf7da11",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-140,
180
],
"typeVersion": 1
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "e2e2f00d-cbbd-4bc4-a8f3-99e3b58192a2",
"leftValue": "={{ $json.name }}",
"rightValue": "House",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "685aeb0e-2b7c-4450-95ea-b862b2c37141",
"leftValue": "={{ $json.name }}",
"rightValue": "Reggae",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "f0fa8fbe-fdce-48b1-834b-822e467bec1b",
"leftValue": "={{ $json.name }}",
"rightValue": "Rock",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "180b27c6-73d4-46fc-bdba-d544b6af9232",
"leftValue": "={{ $json.name }}",
"rightValue": "Rammstein",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "2edfdfc9-76c1-4cc2-9c74-6ceb30064038",
"leftValue": "={{ $json.name }}",
"rightValue": "NFS MW",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "c7140fc6-f12a-4433-b142-e1a8f53dbb6e",
"leftValue": "={{ $json.name }}",
"rightValue": "Christmas",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "d70be89e-36f8-4a6e-96ba-b64be1efdc7c",
"leftValue": "={{ $json.name }}",
"rightValue": "Deutschrap",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "11027cbf-6e17-4543-84cd-9ea6d575016d",
"leftValue": "={{ $json.name }}",
"rightValue": "Ami-Rap",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "ba9b7a32-5f33-4c7c-a7f8-ebbffb65ed72",
"leftValue": "={{ $json.name }}",
"rightValue": "Latino",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "05f2f0c2-0820-4a03-882d-cae646cfd12c",
"leftValue": "={{ $json.name }}",
"rightValue": "Chillout",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "or"
},
"options": {
"ignoreCase": true
}
},
"id": "e2089314-5d34-424a-9093-f0c1b5d749ee",
"name": "Misc Filter",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
540,
1200
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "e2e2f00d-cbbd-4bc4-a8f3-99e3b58192a2",
"leftValue": "={{ $json.name }}",
"rightValue": "1980s German",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "685aeb0e-2b7c-4450-95ea-b862b2c37141",
"leftValue": "={{ $json.name }}",
"rightValue": "German/Schlager",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "f0fa8fbe-fdce-48b1-834b-822e467bec1b",
"leftValue": "={{ $json.name }}",
"rightValue": "2020s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "180b27c6-73d4-46fc-bdba-d544b6af9232",
"leftValue": "={{ $json.name }}",
"rightValue": "2010s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "2edfdfc9-76c1-4cc2-9c74-6ceb30064038",
"leftValue": "={{ $json.name }}",
"rightValue": "2000s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "c7140fc6-f12a-4433-b142-e1a8f53dbb6e",
"leftValue": "={{ $json.name }}",
"rightValue": "1990s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "d70be89e-36f8-4a6e-96ba-b64be1efdc7c",
"leftValue": "={{ $json.name }}",
"rightValue": "1980s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "11027cbf-6e17-4543-84cd-9ea6d575016d",
"leftValue": "={{ $json.name }}",
"rightValue": "1970s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "ba9b7a32-5f33-4c7c-a7f8-ebbffb65ed72",
"leftValue": "={{ $json.name }}",
"rightValue": "1960s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
},
{
"id": "05f2f0c2-0820-4a03-882d-cae646cfd12c",
"leftValue": "={{ $json.name }}",
"rightValue": "1950s",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "or"
},
"options": {
"ignoreCase": true
}
},
"id": "f7e96f13-8720-405f-815c-a214cbbb07d8",
"name": "Annual filter",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
540,
820
]
},
{
"parameters": {
"options": {}
},
"id": "1a9b591c-88b6-4be6-9bd6-27ebcf8e5935",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
800,
1200
]
},
{
"parameters": {
"options": {}
},
"id": "4cc22493-bc8e-46dc-b740-0240740f281e",
"name": "Loop Over Items1",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
800,
820
]
},
{
"parameters": {},
"id": "1689b8cd-9b95-4bc2-ba0c-317ffec7c52e",
"name": "Merge all Playlist Tracks",
"type": "n8n-nodes-base.merge",
"position": [
1200,
1040
],
"typeVersion": 2.1,
"alwaysOutputData": true
},
{
"parameters": {
"mode": "combine",
"mergeByFields": {
"values": [
{
"field1": "track.uri",
"field2": "track.uri"
}
]
},
"joinMode": "keepNonMatches",
"outputDataFrom": "input1",
"options": {}
},
"id": "8cbd4efe-154f-4c5c-a1c4-1e56057b08e4",
"name": "Merge All & Everything",
"type": "n8n-nodes-base.merge",
"position": [
1420,
1200
],
"typeVersion": 2.1,
"alwaysOutputData": true
},
{
"parameters": {
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "81f9e3a7-eef0-462c-9d82-db894b19a110",
"operator": {
"type": "object",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
},
"options": {}
},
"id": "238de5bf-24a0-47b3-b316-911715e8fc00",
"name": "Check if tracks to add is NOT empty1",
"type": "n8n-nodes-base.if",
"position": [
1640,
1200
],
"typeVersion": 2
},
{
"parameters": {
"options": {}
},
"id": "61d17f41-1958-406f-b998-521dc22acc1d",
"name": "Loop Over Items2",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
1900,
1200
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "e2e2f00d-cbbd-4bc4-a8f3-99e3b58192a2",
"leftValue": "={{ $json.name }}",
"rightValue": "Everything",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "or"
},
"options": {
"ignoreCase": true
}
},
"id": "617ccce4-41a0-493e-95b8-e84fe4b50ece",
"name": "Result filter",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
540,
1020
]
},
{
"parameters": {
"resource": "playlist",
"operation": "getTracks",
"id": "={{ $json.uri }}",
"returnAll": true
},
"id": "515599ef-1ed7-4cb8-ab00-e606a0fedbb8",
"name": "Get Playlist Tracks1",
"type": "n8n-nodes-base.spotify",
"typeVersion": 1,
"position": [
1040,
820
],
"credentials": {
"spotifyOAuth2Api": {
"id": "",
"name": "Placeholder"
}
}
},
{
"parameters": {
"resource": "playlist",
"operation": "getTracks",
"id": "={{ $json.uri }}",
"returnAll": true
},
"id": "a18e4302-516f-47ef-a598-e494deeab4f4",
"name": "Get Playlist Tracks2",
"type": "n8n-nodes-base.spotify",
"typeVersion": 1,
"position": [
800,
1020
],
"credentials": {
"spotifyOAuth2Api": {
"id": "",
"name": "Placeholder"
}
}
},
{
"parameters": {
"resource": "playlist",
"operation": "getTracks",
"id": "={{ $json.uri }}",
"returnAll": true
},
"id": "19af8b9c-dbcf-454d-b307-80896b75c9b3",
"name": "Get Playlist Tracks3",
"type": "n8n-nodes-base.spotify",
"typeVersion": 1,
"position": [
1040,
1200
],
"credentials": {
"spotifyOAuth2Api": {
"id": "",
"name": "Placeholder"
}
}
},
{
"parameters": {
"resource": "playlist",
"id": "={{$node[\"Result filter\"].json[\"uri\"]}}",
"trackID": "={{ $json.track.uri }}",
"additionalFields": {}
},
"id": "ee303b0e-5625-495b-9705-dc814cbfc5ba",
"name": "Add tracks to common playlist",
"type": "n8n-nodes-base.spotify",
"position": [
2120,
1200
],
"typeVersion": 1,
"credentials": {
"spotifyOAuth2Api": {
"id": "",
"name": "Placeholder"
}
}
},
{
"parameters": {
"url": "http://healthchecks:8000/ping/a9c25a3f-5fe1-4bf8-8055-4e6e837f0ac7",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"id": "c4d97740-4f9d-40b6-8817-6aa1cffa00fb",
"name": "Healthchecks Confirmation",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
2300,
1420
]
}
],
"pinData": {},
"connections": {
"CRON": {
"main": [
[
{
"node": "Get User's Playlists",
"type": "main",
"index": 0
}
]
]
},
"Get User's Playlists": {
"main": [
[
{
"node": "Result filter",
"type": "main",
"index": 0
},
{
"node": "Misc Filter",
"type": "main",
"index": 0
},
{
"node": "Year filter",
"type": "main",
"index": 0
}
]
]
},
"Misc Filter": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"loop over items": {
"main": [
[
{
"node": "Merge all Playlist Tracks",
"type": "main",
"index": 1
}
],
[
{
"node": "Get Playlist Tracks3",
"type": "main",
"index": 0
}
]
]
},
"year filter": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items1": {
"main": [
[
{
"node": "Merge all Playlist Tracks",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Playlist Tracks1",
"type": "main",
"index": 0
}
]
]
},
"Merge all Playlist Tracks": {
"main": [
[
{
"node": "Merge All & Everything",
"type": "main",
"index": 0
}
]
]
},
"Merge All & Everything": {
"main": [
[
{
"node": "Check if tracks to add is NOT empty1",
"type": "main",
"index": 0
}
]
]
},
"Check if tracks to add is NOT empty1": {
"main": [
[
{
"node": "Loop Over Items2",
"type": "main",
"index": 0
}
],
[
{
"node": "Healthchecks Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items2": {
"main": [
[
{
"node": "Healthchecks Confirmation",
"type": "main",
"index": 0
}
],
[
{
"node": "Add tracks to common playlist",
"type": "main",
"index": 0
}
]
]
},
"Result filter": {
"main": [
[
{
"node": "Get Playlist Tracks2",
"type": "main",
"index": 0
}
]
]
},
"Get Playlist Tracks1": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Get Playlist Tracks2": {
"main": [
[
{
"node": "Merge All & Everything",
"type": "main",
"index": 1
}
]
]
},
"Get Playlist Tracks3": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Add tracks to common playlist": {
"main": [
[
{
"node": "Loop Over Items2",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"saveManualExecutions": true,
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1"
},
"versionId": "ee6f9a76-a2cb-428c-8b74-6070248d9c31",
"meta": {
"templateId": "2044",
"templateCredsSetupCompleted": true,
"instanceId": "5e6250d6f37f6431b4c67a21e494638980ffcc300467ef9c325b1b0679773371"
},
"id": "rJ3wPXQ1TLqH5SFQ",
"tags": []
}
YouTube video implementation
Conclusion
With n8n, you can finally enjoy your music in a whole new way. You no longer have to choose between different playlists or constantly switch back and forth. Instead, you can combine all your favorite songs from different genres and decades in a single playlist. Thanks to automation, this playlist always stays up to date without you having to worry about it.
Setting it up is easier than you might think. All you need is a Spotify account, an n8n account and a little time to set up the workflow. Once you have created a new playlist, you can adjust the filters and enter your Spotify access data. The workflow is already running and ensures that your playlist is updated regularly.
With n8n, you have full control and flexibility to organize your music exactly the way you want it. No more annoying manual updates, no more missed new tracks - just pure music enjoyment. Start now and enjoy your perfectly organized all-in-one playlist!
0 Comments