How to create Constant (5-10 second) user workflow while user is not on website

I’m not sure if I just need a small pointer but I am making a spotify app and need to have API calls and create database records while the user is not on the website. I am aware of recurring events but those are only daily at most and i would want something every 5-10 seconds to check what they’re listening to. Any ideas would be appreciated.

I am not too familiar with spotify but maybe they have an api where you can access the users and have them send you a webhook anytime one of your user’s plays a song. That would run anytime they use spotify and they would not have to be logged in.

I dont see anything about webhooks on their APi documentation, and it seems to be a request feature.

To give some context I am currently using this plugin
Spotify Complete Plugin | Bubble
and I am using the currently played Item ID to pull the latest song they are on, and then using some 5-10 second workflow to store it in a database. Only problem is this is currently only running when the user has the page open.

I also looked into Zapier + spotify for webhooks but they did not offer a currently played webhook.

thanks for the reply though, i am a newb at this but I will update if i find a work around to log songs while users are away from the site.

I’m not going to explain API’s in general (or web applications in general) to you, but from a quick peruse of Spotify’s API docs, there’s literally no way to do what you want to do.

There would have to be a webhook that would fire on each song play from Spotify to your app. This isn’t even a reasonable thing to expect.

I was hoping for something more on bubble’s side to accomplish this like a 5-10 second workflow in the back end section to call on the api to get the current user’s song and compare it to if its already in the database of songs then add or dont add it. I understand a web hook may increase the efficiency of this task or simply make it possible but I’m just trying to see if this is possible on this platform.