Skills & Plugins Productivity Skills

OpenClaw Spotify Skill: Music & Podcast Automation for Agents

Use OpenClaw's Spotify skill to control playback, build playlists, search tracks, and trigger music-based automations — with full Spotify Web API integration.

MK
M. Kim
Integration Engineer
2025-02-22 12 min 4.8k views
Updated Mar 2025
Key Takeaways
Playback control requires Spotify Premium; search and playlist management work on free accounts.
OAuth 2.0 Authorization Code flow — OpenClaw handles token refresh automatically after initial setup.
Create playlists, add tracks, control playback, and search across all Spotify content types.
Most creative use: auto-generate focus playlists based on task type or time of day.
Required scopes vary by feature — request only what your workflow actually needs.

Music automation sounds like a novelty until you realise your agent can build a contextual playlist for every task, switch to focus music when a deadline is near, or log podcast listening as learning activity. The Spotify skill makes all of this a one-config setup.

What the Spotify Skill Does

OpenClaw's Spotify skill wraps the Spotify Web API into skill actions. The four main capability areas:

  • Playback control — play, pause, skip, volume, device transfer (Premium required)
  • Search — find tracks, albums, artists, playlists, podcasts by any query
  • Playlist management — create, update, populate playlists programmatically
  • Library access — read and update saved tracks, albums, and shows
💡
Start with playlist creation — no Premium needed
If you don't have Spotify Premium, start with playlist automation. Creating topic-based playlists, adding tracks from search results, and organizing your library all work on free accounts. Add playback control later if you upgrade.

Spotify API Setup

Create a Spotify Developer App at developer.spotify.com/dashboard. Add https://localhost:8080/callback as a redirect URI. Note your Client ID and Client Secret.

Run the OAuth Authorization Code flow once to get your initial access and refresh tokens. OpenClaw stores and rotates the refresh token automatically after that.

# Spotify credentials for OpenClaw
SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
SPOTIFY_REFRESH_TOKEN=your_refresh_token
Playback control needs an active device
The play/pause/skip actions require an active Spotify device. If no device is active (no open Spotify client anywhere), the API returns a 404. Build a device check into playback workflows to handle this gracefully.

OpenClaw Configuration

skills:
  spotify:
    enabled: true
    client_id: ${SPOTIFY_CLIENT_ID}
    client_secret: ${SPOTIFY_CLIENT_SECRET}
    refresh_token: ${SPOTIFY_REFRESH_TOKEN}
    default_device: ""  # device ID or leave blank for active device
    scopes:
      - user-read-playback-state
      - user-modify-playback-state
      - playlist-modify-public
      - playlist-modify-private
      - user-read-currently-playing

Automation Workflows

Auto-generate a focus playlist from a topic and start playing it:

skills:
  focus_playlist:
    trigger: event(task.started)
    actions:
      - skill: spotify
        action: search
        query: "deep focus instrumental {{event.task_type}}"
        type: playlist
        limit: 5
      - skill: spotify
        action: create_playlist
        name: "Focus: {{event.task_type}} {{date}}"
        tracks: "{{spotify.results[0].tracks}}"
      - skill: spotify
        action: play
        context_uri: "{{spotify.playlist.uri}}"

Log currently playing track to your daily journal in Notion:

skills:
  log_listening:
    trigger: cron(0 * * * *)  # every hour
    actions:
      - skill: spotify
        action: get_currently_playing
      - skill: notion
        action: append_to_page
        page_id: "daily-journal-id"
        content: "Listening: {{spotify.track.name}} by {{spotify.track.artist}}"

Common Mistakes

Requesting all scopes upfront increases the OAuth consent screen clutter and creates broader access than needed. Request only the scopes your actual workflow uses.

  • No active device error — playback calls fail if no Spotify client is open. Add a get_devices check and handle the empty case with a meaningful fallback.
  • Rate limiting on heavy search workflows — Spotify's API rate limit is 30 requests per second. Heavy playlist generation workflows (searching hundreds of tracks) can hit this. Add delays between batch calls.
  • Not handling empty search results — some queries return zero results. Always check that search results exist before using them in playlist actions.
  • Using track URIs vs track IDs interchangeably — the add_to_playlist action requires Spotify URIs (spotify:track:ID), not plain IDs. The search action returns both; reference the .uri field, not .id.

Frequently Asked Questions

Does the Spotify skill require a Premium account?
Playback control requires Spotify Premium. Search, playlist management, and data retrieval work on free accounts.

Can OpenClaw control Spotify playback remotely?
Yes. With Premium, OpenClaw can play, pause, skip, set volume, and transfer playback between devices using the Spotify Web API.

Can OpenClaw create Spotify playlists automatically?
Yes. The skill creates playlists, adds tracks, reorders items, and updates playlist metadata on behalf of the authenticated user.

How does OpenClaw authenticate with Spotify?
Via OAuth 2.0 Authorization Code flow. You need a Spotify Developer App; OpenClaw handles token refresh automatically after initial setup.

Can OpenClaw search for tracks and albums?
Yes. The search action supports tracks, albums, artists, playlists, and podcasts, returning structured JSON with IDs and metadata.

What scopes does OpenClaw need for Spotify?
For full functionality: user-read-playback-state, user-modify-playback-state, playlist-modify-public, playlist-modify-private, user-read-currently-playing.

MK
M. Kim
Integration Engineer · aiagentsguides.com

M. Kim builds creative automation workflows and covers media and entertainment integrations at aiagentsguides.com.

Get the OpenClaw Weekly

New guides, tips, and updates every week. Free forever.