Spotify sample
Using the Spotify sample bundle
The spotify-current-song example bundle in samples/spotify-current-song
demonstrates the ability to get the current playing song of a user. Here is a
guide to how to get it working.
Prerequisites
You will need a working nodecg-io
installation. If you have non yet take a
look at installation guide. You may need to
install this bundle, so take a look at the
“Try an included sample”-Guide. It
will also tell you how to log in and how to use the GUI.
You also need:
- A Spotify account and a registered Spotify application and the associated client id/client secret.
Note
If you don't have a registered application, yet you can follow this guide. As a redirect URL use http://localhost:9090/nodecg-io-spotify/spotifycallback.
Configure the Spotify sample bundle
-
In NodeCG, create a new Spotify service instance.
-
Enter your client ID and secret for Spotify:
{ "scopes": ["user-read-playback-state"], "clientId": "0123456789abcdef0123456789abcdef", "clientSecret": "0123456789abcdef0123456789abcdef" }
After entering it, click save.
Note
This sample requires the
user-read-playback-state
scope, but you can require other scopes if you want to use functions that require them. A list of all scopes can be found here. -
Set the sample's (
spotify-current-song
) dependency to be the newly created service instance (of typespotify
). -
Check the NodeCG logs:
You should see an error or a success message and the current playing song with names and artists.