

The reason for the apply to each is because the artist data shows up in both the album and track information. If it is, continue on and sift through the JSON data to set the artist & track variables: Firstly – a condition that if the track isn’t currently playing, we should stop the workflow. Now that we’ve done the maths, let’s get the data out. Now we add those seconds to the current time: To do that, we take away our current progress from the duration, and because it’s all in milliseconds we divide by 1,000 to give us seconds: Once we’ve got that, we then need to calculate the time when this status message should expire – ideally the end of the track. (see the appendix at the end of the blog post for the JSON schema) If Spotify is paused or not running the workflow ends without updating your Teams status messageįrom here we initialise some variables and parse the output to help with text cleanup and presentation later:.The status message is set to expire at the end of the song.Here’s what the final workflow looks like:Ī couple of the key features of this workflow:
#SPOTIFY STATS TRACKER HOW TO#
You can read about how to use the Send an HTTP request to SharePoint connector to set your Teams status here: And we’re going to use a Power Automate action that is completely unrelated. Because of the importance of this solution, we’re going to use endpoints that are undocumented and unsupported. So now that we have our “trigger” and initial data collection, how do we get this into our Teams status message? No Microsoft Graph required here. I followed the instructions in this great blog post that explains how to create a custom connector for Power Platform, which can be used for the GET request: And because songs have differing track lengths, I opted to have it run every 5 minutes between 9am and 6pm. So opted for the lazy man’s “trigger” – a workflow that runs on an interval. The first challenge was the fact that the only way for Spotify to trigger anything was to use the Web Client SDK, which was well beyond my comfort zone as I am not a coder. Spotify has publicly available APIs which are well document and clearly laid out. How can I inform my colleagues what I’m currently listening to on Spotify currently? Because it’s clearly so important to me… Yeah ok, enough faff, on with the “solution”. Plus, how does that make any difference to my colleagues?ĭo I have the right to be angry in a call just because I was listening to Sepultura or Fear Factory?ĭo I have the right to be crass and joking just because I was listening to The Lonely Island? The Solution? I thought, maybe let’s put “Current mood is based on: ” but thought that it wasn’t accurate as sometimes my music choice is driven by the mood as well as the other way around. (yes, I think of what workflows I can build while walking the dog – don’t you!?) Personally, it just came about as I had been experimenting with a couple of other things in Power Apps & Automate, and one morning while walking the dog I wondered if this was at all possible. There are a number of existing social tools and apps that will show what you’re currently playing, but this is the worksplace. I honestly couldn’t think of how in any universe this would benefit a single person – be it you sharing the information, or other people reading it.

No, you’re right… this particular thing is completely and utterly useless. This is possibly the most important thing you can implement as a user, in your Microsoft 365 environment.

Think of the cultural, teamwork, and employee benefits. Let’s acknowledge the sheer importance of what you’re about to read.
