Spotify Playlist Builder
name: spotify-playlist
by codeaholicman · published 2026-03-22
$ claw add gh:codeaholicman/codeaholicman-spotify-playlist---
name: spotify-playlist
description: Build and manage Spotify playlists from natural language requests. Search tracks/artists/albums, create playlists, manage tracks, view listening history. Use when the user asks to create a playlist, find music, check what they've been listening to, or any Spotify-related request. Examples - "make me a playlist for a rainy Sunday", "what have I been listening to lately", "find songs like Bonobo".
---
# Spotify Playlist Builder
Build playlists from natural language using the Spotify Web API.
Updated for the February 2026 API changes (Dev Mode).
Prerequisites
Setup
1. Create an app at https://developer.spotify.com/dashboard
2. Set redirect URI to `http://127.0.0.1:8765/callback` (must be `127.0.0.1`, not `localhost` - Spotify blocks `localhost`)
3. Run auth:
python3 scripts/auth.py --client-id <ID> --client-secret <SECRET>4. Open the printed URL in a browser and authorize
5. If the callback page loads automatically, done. Otherwise copy the full redirect URL and run:
python3 scripts/auth.py --client-id <ID> --client-secret <SECRET> --code-url "<FULL_REDIRECT_URL>"Tokens are saved to `~/.openclaw/workspace/config/.spotify-tokens.json` and auto-refresh on 401.
API Script Reference
All commands in `scripts/spotify.py`. All output JSON.
# Search (tracks, artists, or albums)
python3 scripts/spotify.py search "bohemian rhapsody" --limit 5
python3 scripts/spotify.py search "Bonobo" --type artist --limit 3
python3 scripts/spotify.py search "Moon Safari" --type album --limit 3
# Create playlist
python3 scripts/spotify.py create "Rainy Sunday" --description "Chill vibes" --private
# Add/remove tracks (by Spotify URI)
python3 scripts/spotify.py add <playlist_id> spotify:track:xxx spotify:track:yyy
python3 scripts/spotify.py remove <playlist_id> spotify:track:xxx
# List playlists
python3 scripts/spotify.py my-playlists --limit 10
# View playlist contents
python3 scripts/spotify.py playlist-tracks <playlist_id> --limit 50
# Listening history
python3 scripts/spotify.py top-tracks --time-range short --limit 20
python3 scripts/spotify.py recently-played --limit 20
# Profile
python3 scripts/spotify.py mePlaylist Building Workflow
When a user asks for a playlist:
1. **Interpret the request** - extract mood, genre, era, activity, or specific artists/songs
2. **Search for tracks** - use multiple targeted searches to find tracks matching the vibe
3. **Use listening history** - check `top-tracks` and `recently-played` to personalize if relevant
4. **Create and populate** - create the playlist with a creative name and description, add 15-30 tracks
5. **Share the link** - return the Spotify URL
Tips
Feb 2026 API Limitations (Dev Mode)
Cron Ideas
Combine with OpenClaw cron for automated playlists:
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...