Spoticlaw for Openclaw

A lightweight Python-based Spotify Web API client designed for AI agents to manage music playback, search, and playlists.

ledzgio
v1.0.7
Feb 23, 2026
0
1.4k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install spoticlaw

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install spoticlaw using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Spoticlaw?

Spoticlaw is a specialized integration for Openclaw Skills that enables AI agents to interact directly with the Spotify Web API using direct HTTP requests. Unlike traditional libraries that might have heavy dependencies, Spoticlaw is built for efficiency and security within agentic workflows. It provides a robust interface for searching tracks, managing library content, and controlling active playback devices.

One of the standout features of this skill is its security-first approach to authentication. OAuth tokens are generated locally and stored in a cache file, ensuring that sensitive credentials never pass through the AI model itself. This makes it an ideal choice for developers building music-aware assistants or automated curation tools using Openclaw Skills.

Spoticlaw Use Cases

  • Automating music playback based on context or mood through an AI agent.
  • Programmatically creating and updating Spotify playlists from natural language prompts.
  • Synchronizing your music library or following artists based on search results.
  • Managing podcast episodes and show subscriptions automatically.
  • Transferring playback between different Spotify-connected devices via CLI or agent commands.

How Spoticlaw Works

  1. The user performs a one-time local authentication to generate a secure .spotify_cache token file.
  2. The AI agent loads the Spoticlaw primitives and environment variables (Client ID and Secret).
  3. When a command is issued, the agent calls specific Python functions (search, player, library) to communicate with Spotify.
  4. Spoticlaw handles the HTTP request lifecycle, including headers and parameters, and returns structured JSON data.
  5. If an access token expires, the library automatically uses the refresh token and client credentials to maintain the session.

Spoticlaw Setup

To get started with this addition to your Openclaw Skills library, follow these steps:

# Install dependencies
pip install requests python-dotenv

# Configure your Spotify Developer credentials in a .env file
# SPOTIFY_CLIENT_ID=your_id
# SPOTIFY_CLIENT_SECRET=your_secret
# SPOTIFY_REDIRECT_URI=http://127.0.0.1:8888/callback

# Generate the local token
cd skills/spoticlaw/scripts
python auth.py

After authorizing in your browser, copy the generated .spotify_cache file to your agent's skill directory.

Spoticlaw Data Schema & Taxonomy

Spoticlaw organizes its data through local configuration files and standardized API responses:

Data Component Purpose
.spotify_cache Stores OAuth2 access and refresh tokens locally.
.env Contains sensitive API credentials (ID, Secret, Redirect URI).
Track Metadata Returns JSON including URI, duration_ms, artist name, and album info.
Device Objects Lists active Spotify Connect devices with unique IDs and volume levels.
Scopes Configurable permissions for reading/writing library and playback state.

Spoticlaw Advanced Features

  • Local Token Refresh: Handles session persistence without re-authorization as long as client credentials match.
  • Device Transfer: Programmatically move playback from a mobile device to a desktop or smart speaker.
  • Composite Workflows: Combines multiple API calls (e.g., search + create playlist + add items) into single agent actions.
  • Privacy Protection: Ensures OAuth tokens are handled in a local environment, outside the LLM's context window.
  • Podcast Integration: Full support for searching and playing show episodes alongside music.

SKILL.md


Loading

Related Openclaw Skills

Featured*