Accessing user's recent music history through Spotify or Facebook APIs

I want to build an application that can retrieve a person’s music listening history from their Spotify account.

Basically, I noticed that when you look at someone’s Facebook profile, there’s a section that shows what songs they’ve been playing recently through Spotify integration. I’m wondering if there’s a way to get this same information programmatically.

Is there an official API endpoint from either Spotify or Facebook that lets developers pull this recent listening activity? I’ve looked through some documentation but I’m not sure which service would be the best approach for getting this data.

Any guidance on where to start or which platform offers better access to this type of user music data would be really helpful.

yea, definitely go with Spotify’s Web API! the recently played endpoint is super easy to use. just make sure u get your user auth and ask for user-read-recently-played. I’ve tried fbook’s music API and it’s way more complicated.

Built something similar last year - definitely go with Spotify’s Web API. Facebook’s gotten way too restrictive since they changed their data policies. You’ll want the /me/player/recently-played endpoint - it grabs the last 50 tracks from the past 24 hours. OAuth 2.0 setup is pretty straightforward, just make sure you request the user-read-recently-played scope. Quick heads up though - users have to explicitly approve this data access, so be upfront about what you’re pulling. The response gives you track details, timestamps, and play context, which should handle most scenarios.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.