← Public packages
@kentcdodds/spotify
Spotify playback, playlist, search, library, and device helpers.
README.md
52 lines · 2.2 KB · Markdown@kentcdodds/spotify
Intent
Account-aware Spotify playback, playlist, search, library, and device helpers
for Kody workflows. Supports Kent's personal account (default) and the family
"Dodds Kids" account via an optional account param on every export.
Low-level REST calls come from an OpenAPI-scaffolded client (sonallux Spotify
Web API spec) authenticated with createAuthenticatedFetch against the
spotify / spotify-family integrations. Public exports still return
parsed/normalized JSON.
What it does
- Control Spotify Connect playback (play, pause, skip, seek, volume, shuffle, repeat, queue, transfer)
- Read playback state, devices, queue, recently played, top items, and tracks
- Create or edit playlists, follow playlists, and save tracks
- Search the catalog and fetch recommendations
- Target whole-home Sonos via the
familyaccount for household playlists - Hosted package app at
/packages/spotify(owner UI surface)
Prerequisites / setup
- Connect OAuth integrations
spotify(personal, default) andspotify-family(family/kids) as needed. - Reconnect at
/connect/oauth?provider=spotifyor/connect/oauth?provider=spotify-familywhen tokens expire. - Approve host
api.spotify.comon those integrations. - The family account has no default fallback device or collection URI —
playback needs an active device or an explicit selector (
deviceNamepreferred). - Agents: see
AGENTS.mdfor import paths and smoke checks.
Device targeting
Prefer human selectors so opaque Spotify Connect device ids never cross the agent tool boundary (some hosts mis-classify those ids as credentials):
- Omit device selectors → active Connect device
- Pass
deviceName(case-insensitive substring) and optionaldeviceType - Advanced escape hatch:
deviceId/device_id(agents should avoid copying ids fromget-devices)
Done when
- OAuth
spotify(andspotify-familyif used) connected;api.spotify.comapproved - Read-only checks (
playback-state,get-devices, orlist-playlists) succeed for the intended account - Playback helpers target devices by name when not using the active device