# Send Spotify Controller to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "spotify-controller",
    "name": "Spotify Controller",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/egemenyerdelen/spotify-controller",
    "canonicalUrl": "https://clawhub.ai/egemenyerdelen/spotify-controller",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/spotify-controller",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=spotify-controller",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "scripts/spotify.py",
      "SKILL.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "spotify-controller",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-10T03:05:41.624Z",
      "expiresAt": "2026-05-17T03:05:41.624Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=spotify-controller",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=spotify-controller",
        "contentDisposition": "attachment; filename=\"spotify-controller-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "spotify-controller"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/spotify-controller"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/spotify-controller",
    "downloadUrl": "https://openagent3.xyz/downloads/spotify-controller",
    "agentUrl": "https://openagent3.xyz/skills/spotify-controller/agent",
    "manifestUrl": "https://openagent3.xyz/skills/spotify-controller/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/spotify-controller/agent.md"
  }
}
```
## Documentation

### Spotify Controller Skill

Control Spotify playback from your AI agent using the official Spotify Web API.

This works across setups (local machine, Docker, VPS, and hybrid environments). It is especially useful for fixing Spotify control pain in headless VPS deployments. The server does not need a browser or a local Spotify client.

### What this skill provides

A CLI workflow around spotify.py
Playback control (play, pause, next, prev)
Track lookup (search) and quick play (playsearch)
Direct URI playback (playtrack spotify:track:...)
Device management (devices, setdevice)
Volume control (volume 0-100, where supported)

### Requirements

Python 3 available in runtime/container
requests package installed
Spotify Premium account
Spotify Developer app credentials
Environment variables:

SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET
SPOTIFY_REFRESH_TOKEN

Install dependency:

uv pip install requests --system

(Alternative: pip install requests)

If you build OpenClaw in Docker, add this to your Dockerfile when requests is not already present:

RUN uv pip install requests --system

### 1) Create a Spotify Developer App

Go to: https://developer.spotify.com/dashboard
Click Create App
Enter any app name/description
Add Redirect URI:

http://127.0.0.1:8888/callback


Enable Web API access
Save and copy:

Client ID
Client Secret

### 2) Get a refresh token (one-time, on local machine)

Open this URL in your browser (replace YOUR_CLIENT_ID):

https://accounts.spotify.com/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://127.0.0.1:8888/callback&scope=user-modify-playback-state%20user-read-playback-state%20user-read-currently-playing

Approve access, then copy the code value from the redirected URL.

Exchange code for tokens:

curl -s -X POST "https://accounts.spotify.com/api/token" \\
  -H "Content-Type: application/x-www-form-urlencoded" \\
  -d "grant_type=authorization_code&code=YOUR_CODE&redirect_uri=http://127.0.0.1:8888/callback&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"

From response JSON, copy refresh_token.

refresh_token is typically long-lived, but can be invalidated if app access is revoked, app settings change, or credentials rotate.

### 3) Add credentials to .env

SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
SPOTIFY_REFRESH_TOKEN=your_refresh_token

### 4) Pass env vars to Docker compose service

In docker-compose.yml service environment: section:

- SPOTIFY_CLIENT_ID=${SPOTIFY_CLIENT_ID}
- SPOTIFY_CLIENT_SECRET=${SPOTIFY_CLIENT_SECRET}
- SPOTIFY_REFRESH_TOKEN=${SPOTIFY_REFRESH_TOKEN}

### 5) Restart service/container

docker compose down
docker compose up -d openclaw-gateway

chown <runtime_user>:<runtime_group> /path/to/workspace/spotify.py
chmod 664 /path/to/workspace/spotify.py

### Usage

Run commands from workspace:

python3 spotify.py <command>

CommandDescriptionpython3 spotify.py statusShow current playback state and trackpython3 spotify.py playResume playbackpython3 spotify.py pausePause playbackpython3 spotify.py nextSkip to next trackpython3 spotify.py prevGo to previous trackpython3 spotify.py volume 80Set volume (0–100) where supportedpython3 spotify.py search trackSearch tracks (top results)python3 spotify.py playsearch "track"Search and play first resultpython3 spotify.py playtrack spotify:track:URIPlay specific track URIpython3 spotify.py devicesList available Spotify devicespython3 spotify.py setdevice "BEDROOM-SPEAKER"Set active device by name or id

### VPS / Headless behavior notes

Headless server control works because playback is executed on Spotify Connect devices (phone/desktop/web), not the server audio output.
You still need at least one active Spotify device session.

If you see NO_ACTIVE_DEVICE:

Open Spotify on target device
Start any track manually once
Run python3 spotify.py devices
Retry command

### Known Spotify API limitations (expected)

Some devices/content contexts may return 403 Restriction violated for play, prev, or other controls.
Some devices may reject remote volume changes (VOLUME_CONTROL_DISALLOW).
Device handoff can lag; immediate status after transfer may briefly show stale state.

These are Spotify-side constraints, not necessarily script bugs.

### Operational guidance for automations

Treat non-zero exit codes as command failures.
Validate environment vars at startup.
Log command + status code for troubleshooting.
Retry once for transient network errors.
Don’t hardcode real credentials in files.

### Security notes

Never commit .env with live secrets.
Rotate app credentials if leaked.
Use least-access scopes required for your workflow.
The script only communicates with accounts.spotify.com and api.spotify.com

### Quick troubleshooting checklist

python3 spotify.py devices shows your target device?
Device is active in Spotify app?
Env vars loaded inside container/runtime?
Premium account confirmed?
Refresh token still valid?
Any Spotify 403 restriction reason in response?

### Claim accuracy

Uses official Spotify Web API ✅
Works on headless VPS ✅
Practical for personal usage ✅
Subject to normal Spotify API behavior/limits ✅
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: egemenyerdelen
- Version: 1.0.1
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-10T03:05:41.624Z
- Expires at: 2026-05-17T03:05:41.624Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/spotify-controller)
- [Send to Agent page](https://openagent3.xyz/skills/spotify-controller/agent)
- [JSON manifest](https://openagent3.xyz/skills/spotify-controller/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/spotify-controller/agent.md)
- [Download page](https://openagent3.xyz/downloads/spotify-controller)