How to display the currently playing Spotify track as your Teams status message

Let’s renowned the sheer significance of what you’re about to examine.

Think of the cultural, teamwork, popular spotify plays and employee advantages. This is likely the maximum critical thing you can enforce as a user, on your Microsoft 365 surroundings.

No, you’re right… this unique issue is completely and totally vain.

The Challenge?

The Challenge?

I absolutely couldn’t think of how in any universe this would advantage a single character – be it you sharing the statistics, or different humans reading it. There are a number of present social gear and apps with a purpose to show what you’re currently gambling, but that is the worksplace.

Personally, it just came about as I have been experimenting with a couple of different matters in Power Apps & Automate, and one morning even as walking the dog I puzzled if this became at all viable. (yes, I consider what workflows I can build while strolling the dog – don’t you!?)

I idea, perhaps allow’s placed “Current temper is based on: <Spotify track info>” but idea that it wasn’t correct as every now and then my music choice is pushed by the mood as well as the alternative manner around. Plus, how does that make any difference to my colleagues?

Do I have the right to be indignant in a name simply because I become paying attention to Sepultura or Fear Factory?

Do I actually have the proper to be crass and joking simply because I turned into being attentive to The Lonely Island?

The Solution?

Yeah adequate, enough faff, on with the “answer”. How can I tell my colleagues what I’m currently listening to on Spotify presently? Because it’s truely so crucial to me…

Spotify has publicly available APIs which might be properly record and actually laid out. The first venture turned into the fact that the simplest way for Spotify to trigger anything become to apply the Web Client SDK, which turned into properly past my comfort area as I am now not a coder.

So opted for the lazy guy’s “trigger” – a workflow that runs on an c programming language. And due to the fact songs have differing tune lengths, I opted to have it run each five mins among 9am and 6pm. Yes, sure I did. Because it’s that important.

I observed the commands on this exceptional weblog post that explains the way to create a custom connector for Power Platform, which may be used for the GET request:

So now that we have our “cause” and initial facts collection, how do we get this into our Teams popularity message? No Microsoft Graph required right here. Because of the significance of this solution, we’re going to apply endpoints which can be undocumented and unsupported. And we’re going to apply a Power Automate action this is completely unrelated.

You can examine approximately how to use the Send an HTTP request to SharePoint connector to set your Teams repute right herems like:

  • A couple of the key capabilities of this workflow:
  • The repute message is about to expire on the quit of the tune
  • If Spotify is paused or now not going for walks the workflow ends with out updating your Teams popularity message
  • Breaking down the workflow
  • Let’s start with our trigger:

From here we initialise some variables and parse the output to assist with textual content cleanup and presentation later:

Once we’ve were given that, we then want to calculate the time while this reputation message have to expire – preferably the stop of the music.

To try this, we eliminate our contemporary progress from the period, and because it’s all in milliseconds we divide through 1,000 to offer us seconds:

Now we upload the ones seconds to the contemporary time:

Now that we’ve completed the maths, allow’s get the records out. Firstly – a circumstance that if the tune isn’t currently gambling, we need to forestall the workflow. If it’s miles, keep on and sift via the JSON records to set the artist & tune variables:

The cause for the apply to each is because the artist records indicates up in each the album and tune records. I’m certain that step ought to’ve been accomplished better, but workflow efficiency wasn’t precisely a priority.

  • From here we put the 2 collectively:
  • And eventually, we post it to Teams:
  • And then at four:50pm it adjustments to:

Summary

Is this vital for all and sundry? No, I’m pretty certain no one would locate this precious at all.

It turned into genuinely a gimmick that I changed into playing with, and seeing as I figured it out, I concept I may additionally as well share it.

I’m sure the workflow shape and approach may be higher, but that clearly wasn’t the concern right here. If you’ve got a few recommendations for enhancements, permit me know.

Otherwise, if you need the Flow to put in yourself and might’t get it going from the screenshots – allow me recognise.

allow me recognise.

And sure, this workflow will preserve to run even as I’m on vacations, at lunch, taking note of music in my car or at any time I’m going for walks Spotify all through commercial enterprise hours.

Which for the most component is fine as I’m now not embarrassed by way of my musical taste, that’s quite eclectic. However, as I even have two younger daughters and through the years have come to enjoy being attentive to Taylor Swift, The Spice Girls,

Katy Perry, The Wiggles, Big Block Singsong, and many others. And there’s been a few times wherein I’ve played them for my personal entertainment, so it’ll be interesting to see if any of my colleagues remark…