Does the Spotify platform plan to offer any webhooks for third party developers to listen in to changes in user libraries, playlists or the player?
What are some known workarounds if webhooks don't exist?
Spotify + Webhooks by Zapier Integrations Zapier lets you send info between Spotify and Webhooks by Zapier automatically—no code required. Triggers when you create a new playlist.
Webhooks are automated messages sent from apps when something happens. They have a message—or payload—and are sent to a unique URL—essentially the app's phone number or address. Webhooks are almost always faster than polling, and require less work on your end. They're much like SMS notifications.
There are no webhooks in the Web API and I think it will be quite a while before the feature is added https://github.com/spotify/web-api/issues/538
Playlists on Spotify are versioned by a snapshot_id
. When you make an API request to get a playlist, one of the returned fields is snapshot_id
, which identifies the playlist version. If you store this version ID for each playlist, you can check if the playlist has changed remotely since the last time you checked (the snapshot_id
would change if so)
It's important to remember that any changes you make will also affect the snapshot_id
. So you will need to:
snapshot_id
differ from the current one for the playlist?snapshot_id
from the Get Playlist after you made your changesI don't think snapshot_id
is supported for a user's library - you can check a subset of the user's library to detect any additions (e.g. if the first 50 songs in the library haven't changed, then no new songs have been added, and you only had to make one API request instead of umpteen), but you will miss deletions from the rest of the library if you only do this. You can also check the count of songs in the library, which would tell you when songs have been added or deleted, except in the edge case where they add and delete the same number of songs. But this means they have added a song and checking the first 50 songs in the library would catch this.
You can poll for currently playing and recently played songs. If you want to track every song a user listens to, you can achieve this by polling Recently Played at least every 30 * 50 seconds (25 mins). 30 is the number of seconds it takes to listen to a song before Spotify records it as a Listen and 50 is the max number of recently played songs it will serve you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With