Expected Reading Time: 7 minutes

Every Monday, Spotify surprises you with a new playlist: your mix of the week, also known as Discover Weekly. This playlist is specially tailored to your musical tastes and contains 30 songs that you may never have heard before. But here's the catch: after a week, the playlist disappears, and your new favorite songs may disappear with it. What if you don't manage to listen to all the tracks in time? Don't worry, there's a solution - and it's called 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 the "Mix of the Week" on Spotify?

The "Mix of the Week" (Discover Weekly) is a personalized playlist that Spotify users receive every Monday. The playlist is based on your listening behavior and the preferences of similar users. Spotify uses complex algorithms to present you with a selection of 30 songs that you are most likely to enjoy. The big advantage is that you can constantly discover new music. The downside is that the playlist is updated every week and the songs from the previous week are no longer available.

Why should you save the songs?

There are many reasons why you should save the songs from your mix of the week:

  1. Avoid missed opportunitiesMaybe you had a stressful week and didn't have time to listen to the playlist. Without storage, you lose the chance to discover great new music.
  2. Long-term music enjoymentSome songs you might like so much that you want to listen to them again and again. By saving them, you ensure that you can access them at any time.
  3. Create playlist archivesYou can create an archive of your weekly mixes and keep track of your musical tastes over time.

What is n8n?

n8n is a powerful automation platform that allows you to create workflows that connect different services and applications. With a simple drag-and-drop interface, you can create complex automations without in-depth programming knowledge. At the same time, n8n offers advanced users the ability to integrate custom scripts.

How does n8n help you save your mix of the week?

With n8n you can create a workflow that automatically saves the songs from your mix of the week. This is how it works:

  1. Install n8nFirst you need to install n8n on your computer or server. I have already published a blog article on this, including a video, where you can read everything: Otherwise, follow the installation instructions on the n8n website.
  2. Set up Spotify APIYou need access to the Spotify API. Register your application on the Spotify Developer Dashboard and receive the required API keys.
  3. Create workflow: In n8n you create a new workflow. Fortunately, we can access a template directly.
  4. Set up automationSet up your workflow so that it runs automatically every Monday. This will save the songs from your Discover Weekly playlist on a regular basis. But we'll go through this step by step.
Last updated on 6. September 2024 at 01:10 - Image source: Amazon Affiliate Program. All statements without guarantee.

Create Spotify workflow in n8n

n8n and the n8n community provide templates that can be used directly without much effort. In this case we need the template Spotify: Discover Weekly Archive. If you have already opened n8n in a tab of your browser, the page will recognize this and you can immediately open the template by clicking on the "Use Workflow" button. Alternatively, after clicking on "Use Workflow" pressed on "Copy template to clipboard (JSON)". Then create an empty workflow and simply press Ctrl+V to paste everything.

This workflow automatically archives your Spotify Discover Weekly playlist into a separate playlist. The new tracks are compared with the already archived tracks to ensure that only unique tracks are added and the archive playlist is not overloaded.

Setup (Required)

  1. Create a new playlist in your Spotify account
    • Name the playlist as you wish. The default name in the workflow is Discover Weekly Archive. If you choose a different name, make sure that you enter the output key arch in the Switch-node accordingly.
  2. Create your Spotify credentials and update each Spotify node with these credentials
    • Follow the instructions in the n8n documentation to create your Spotify access data. Then select these in the nodes Get User's Playlists, Get Discover Tracks, Get Archive Tracks and Add tracks to Archive playlist and assign the credentials.
  3. Activate the workflow so that it is based on the cron expression in the Schedule-trigger node is executed.

Optional equipment

  • Adjust the cron expression in the Schedule-trigger node to execute the workflow sooner or later when your GENERIC_TIMEZONE is set. You can also set the workflow time zone. You can find support for cron expressions in the n8n documentation.
  • Add nodes at the end of the workflow to send notifications, update a spreadsheet or perform other actions you want to do in addition to archiving your Discover Weekly Tracks.
  • Set up an error workflow to handle problems in the main workflow. You can find an example here and further information on error handling in the n8n documentation.

Bonus idea for monitoring

In a blog article called Set up health checks - reliably monitor cronjobs, scripts & more already talked about the Healthchecks tool. This automation also runs through a cronjob and can be monitored by Healthchecks. To do this, create an HTTP request node with a GET call to your Healthchecks instance with the corresponding ID for the ping and connect the node with "Add tracks to Archive playlist" and the false output of "Check if tracks to add is NOT empty".

You can also copy this code and then simply paste it into your diagram using Ctrl+V and only adjust the URL accordingly:

{
  "meta": {
    "templateId": "2044",
    "templateCredsSetupCompleted": true,
    "instanceId": "5e6250d6f37f6431b4c67a21e494638980ffcc300467ef9c325b1b0679773371"
  },
  "nodes": [
    {
      "parameters": {
        "url": "http://:/ping/",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "ee355090-518f-49f7-9355-1cd5e904a3f4",
      "name": "Healthchecks Confirmation",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        2140,
        880
      ]
    }
  ],
  "connections": {},
  "pinData": {}
}

YouTube video implementation

https://youtu.be/s75vbi5gICA

Conclusion

With n8n, you can easily save your weekly Spotify mix of the week permanently. Every Monday brings you a new, personalized playlist that is perfectly tailored to your musical tastes. But the disappointment is great when the playlist disappears after a week before you've had a chance to listen to all the songs. This is where n8n comes in: it allows you to archive your favorite songs with simple drag-and-drop automations.

Install n8n on your computer or server and set up access to the Spotify API. Then create a workflow that automatically saves the songs from your mix of the week to an archive playlist that you define. You can set this workflow to run every Monday to ensure that no musical discovery is lost.

By using n8n, you not only keep track of your weekly mixes, but you can also ensure that no duplicate tracks end up in your archive. This gives you long-term access to your favorite songs and allows you to look back on your musical career at any time. Try it out and discover how n8n supports your passion for music!

The display of the products was implemented with the affiliate-toolkit plugin.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_US