Announcements

Help Wizard

Step 1

NEXT STEP

How to get user status without constantly sampling?

How to get user status without constantly sampling?

I want to achieve a result similar to Discord's Spotify status integration.

 

ie. Be able to detect if a user is currently listening to music or not without having to do a GET request every x seconds.

 

I looked through the docs and there doesn't seem to mention any subscription methods/webhooks?

 

Would love some ideas!

Reply
2 Replies

Hi chenw, so unfortunately Spotify does not currently offer a webhook or subscription service that allows you to receive real-time updates when a user is listening to music or not.

To check if a user is currently listening to music, you would need to make periodic requests to the Spotify API using the GET Current User's Currently Playing Track endpoint. This would involve making a request to the endpoint every few seconds or minutes to check if the user is still listening to music.

However, this approach can be resource-intensive and may not be ideal for some applications. If you are concerned about the performance impact of making frequent requests to the Spotify API, you may want to consider caching the results of the requests and only updating them periodically. This can help reduce the number of requests and improve the overall performance of your application.

It's also worth noting that some third-party services and libraries may offer integration with the Spotify API and provide additional functionality, such as webhooks or real-time updates. You may want to explore these options if you are looking for a more efficient way to monitor the status of Spotify users.

Warm wishes,

 

-Prague the Dog

PragueSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

"worth noting that some third-party services and libraries may offer integration with the Spotify API and provide additional functionality, such as webhooks or real-time updates"

 

Just so I understand what you mean here, are there 3rd party services that have a special API with Spotify and they're opening it up? Or they just poll Spotify for me and give me a webhook?

 

Suggested posts