Skip to content

Weekly

Reorder a playlist by popularity every week

The best-known tracks move to the top of the playlist each Sunday.

Runs
Weekly
Apps
Spotify
AI
Not needed
Access
playlist-modify-private/public

Send this to your assistant

Create a ClickRuntime automation: every Sunday at noon, reorder my 'Party' playlist so the most popular tracks come first.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A long playlist for a party, a store or a gym is only as good as its first ten songs, and the order is usually an accident of when each track was added. The crowd-pleasers are buried in the middle, and obscure songs open the night. Spotify can sort a playlist by title, artist or date added, but not by how popular a song is, so manually reordering a list of 150 tracks is slow and hardly anyone does it.

Every week, ClickRuntime reads the playlist's tracks along with Spotify's popularity score for each, sorts them from the most popular to the least, and replaces the playlist's order with the result. Songs you add during the week are placed according to their score the next time it runs.

DJs, venues, wedding planners and anyone who curates a playlist that people actually play will get the most value.

What you get out of it

  • Opening tracks hold attention

    The first songs set the mood. Putting the most recognizable ones up front means guests or customers hear familiar music immediately, and they settle in instead of reaching for the skip button.

  • Hit songs are not buried

    In a playlist built over months, the best-known tracks end up at random places. Sorting by popularity brings them forward, so they are played often instead of reached rarely. Listeners notice the difference within the first few songs.

  • Maintenance becomes weekly and automatic

    New tracks find their place without effort. A playlist with 150 songs that grows each week stays organized, and a curator can concentrate on choosing music instead of ordering it. Nobody needs to remember to sort the list before an event.

  • Shuffle and order can both be used

    A listener who plays in order hears the popular tracks first, while shuffle still draws on the whole list. The ordering is useful in both modes. That makes the sorting useful whichever way you listen.

  • Data replaces guesswork

    Spotify's popularity score reflects recent play counts, so the order reflects what people actually listen to. That beats a host's guess at what a crowd likes. A host can enter a room with confidence that the music will be familiar to most people.

How it works

What happens, step by step

  1. Every Sunday, ClickRuntime reads every track in the Spotify playlist you chose, along with how popular each one is on Spotify.

  2. It sorts the tracks from most to least popular.

  3. It saves the new order back to the playlist, so the best-known songs play first.

  4. You get a note with the number of tracks reordered and which song is now at the top.

Before it runs live

  • Connect Spotify

What you get

RunsWeekly
Reorder a playlist by popularity every weektoday, 9:00Succeeded
Spotify · PartyReordered 64 tracks; Acme Anthem (popularity 91) is now first

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Spotify steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
sort_a_playlist_by_popularity.pyexample
from clickruntime import on_trigger, credentials, http

API = "https://api.spotify.com/v1"
PLAYLIST_ID = "your-party-playlist-id"

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('spotify', 'personal')}"}
    tracks, url = [], f"{API}/playlists/{PLAYLIST_ID}/tracks?fields=items(track(uri,popularity,name)),next&limit=100"
    while url:
        page = http.get(url, headers=h).json()
        tracks += [i["track"] for i in page["items"] if i.get("track")]
        url = page["next"]
    tracks.sort(key=lambda t: t["popularity"], reverse=True)
    uris = [t["uri"] for t in tracks]
    http.put(f"{API}/playlists/{PLAYLIST_ID}/tracks", headers=h, json={"uris": uris[:100]})
    for i in range(100, len(uris), 100):
        http.post(f"{API}/playlists/{PLAYLIST_ID}/tracks", headers=h, json={"uris": uris[i:i + 100]})
    return {"sorted": len(uris), "top": tracks[0]["name"] if tracks else None}

FAQ

Common questions

What does the popularity number mean?
Spotify assigns each track a score from 0 to 100 based on how many recent plays it has and how recent they are. It changes over time, so the order may shift a little from week to week.
Will sorting remove any songs?
No. The same tracks stay in the playlist, and only their positions change. Nothing is deleted. If a track appears twice, both copies remain in the order, with duplicates placed next to each other. The order simply follows each track's score.
Can I sort from least popular to most popular?
Yes. If you prefer to start quiet and build to the big songs, or to feature hidden gems first, the order can be reversed. Tell your assistant which direction you want and it will be applied on the next run.
What permissions does it need?
playlist-modify-private/public. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (weekly). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Reorder a playlist by popularity every week” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.