node-red-spotify 1.0.0
Node-RED nodes for the Spotify Web API with OAuth (authorization code / PKCE) via a config node
node-red-spotify
Node-RED nodes for the Spotify Web API, with the OAuth (Authorization Code + PKCE) flow handled by a configuration node.
Nodes
- spotify-config – Client ID/Secret, scopes, redirect URI, Authorise button. Stores tokens in
<userDir>/spotify-web-api-tokens.json(mode 600), refreshes automatically, retries 429/5xx. - spotify-api – ~80 operations (player, search, tracks, albums, artists, playlists, library, user, shows, browse).
Parameters come from
msg.payload.<param>,msg.<param>, or the node fields. IDs can be IDs, URIs or URLs. Optional "fetch all pages". Operation can be set viamsg.operation. - spotify-watch – polls the player and emits on track / state change.
Setup
- Create an app at https://developer.spotify.com/dashboard.
- Install:
cd ~/.node-red && npm install /path/to/node-red-spotifyand restart. - Add a Spotify node, edit the config, copy the displayed Redirect URI
(
<editor origin>/spotify-web-api/callback) into the Spotify app's Redirect URIs. Spotify requires HTTPS (orhttp://127.0.0.1). If Node-RED sits behind a proxy, set the Redirect URI field manually. - Enter Client ID (Secret optional), click Authorise with Spotify, then Done/Deploy.
Notes
- Playback control needs Spotify Premium and an active device.
- Spotify removed audio-features/analysis, recommendations, related-artists etc. for new apps (Nov 2024); they return 403 there.
- Tests:
npm test(mocked HTTP).