Update Microsoft Teams Status with Apple Music “Now Playing”

The Challenge

Here was the challenge: I recently started at a new company that lives in the Office365 ecosystem. I’m part of a fairly small internal team, but we’re growing. Part of our growth is creating culture and setting processes. To that end, I endeavored on what is a seemingly pointless journey to display my currently playing track as my Teams status. Necessary? No. Tone-setting, inviting and culture-building? Yes.

The Landscape

There are good resources for setting your Slack status from Spotify, or even your Teams status from Spotify. In fact, I relied heavily on Loryan Strant’s work, as well as work from DamoBird, Luise Freese, and That API Guy.

The shortcoming, however, lies with Apple Music. While Apple Music has an API, access costs $99/annually through their developer program.

Enter Last.FM

A blast from the past, I recalled my ages-old Last.FM account, which used to provide analytics on user listening data long before Spotify was a twinkle in a coder’s eye. Luckily, Last.FM is alive and well, and has an open and free-to-use API program. Apple Music > Last.FM > Power Apps Custom Connector > Power Automate Flow.

It took me a few days, but I stumbled blindly through the process, and figured out how to make it work. I will not document the entire process, because Loryan and Luise did so masterfully on their aforementioned posts, but I will document what differs for your viewing here…

The Schema/JSON

Setting up the custom connector was easy enough after creating a Last.FM API account. Specifically, I used the user.getRecentTracks request, limiting the response to 1 (the most recently played/currently playing), and formatting that response in JSON.

Here is the raw output of that request, for your reference:

{
    "recenttracks": {
      "track": [
        {
          "artist": {
            "mbid": "",
            "#text": "Jess Bays"
          },
          "streamable": "0",
          "image": [
            {
              "size": "small",
              "#text": "https://lastfm.freetls.fastly.net/i/u/34s/2a96cbd8b46e442fc41c2b86b821562f.png"
            },
            {
              "size": "medium",
              "#text": "https://lastfm.freetls.fastly.net/i/u/64s/2a96cbd8b46e442fc41c2b86b821562f.png"
            },
            {
              "size": "large",
              "#text": "https://lastfm.freetls.fastly.net/i/u/174s/2a96cbd8b46e442fc41c2b86b821562f.png"
            },
            {
              "size": "extralarge",
              "#text": "https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png"
            }
          ],
          "mbid": "",
          "album": {
            "mbid": "",
            "#text": "Temptation (feat. Poppy Baskcomb) - Single"
          },
          "name": "Temptation (feat. Poppy Baskcomb)",
          "@attr": {
            "nowplaying": "true"
          },
          "url": "https://www.last.fm/music/Jess+Bays/_/Temptation+(feat.+Poppy+Baskcomb)"
        },
        {
          "artist": {
            "mbid": "82e454e2-38ee-4e69-89a6-cc65167753d1",
            "#text": "Chase & Status"
          },
          "streamable": "0",
          "image": [
            {
              "size": "small",
              "#text": "https://lastfm.freetls.fastly.net/i/u/34s/a4bd5cb7c9b497d912c43802a40ad380.jpg"
            },
            {
              "size": "medium",
              "#text": "https://lastfm.freetls.fastly.net/i/u/64s/a4bd5cb7c9b497d912c43802a40ad380.jpg"
            },
            {
              "size": "large",
              "#text": "https://lastfm.freetls.fastly.net/i/u/174s/a4bd5cb7c9b497d912c43802a40ad380.jpg"
            },
            {
              "size": "extralarge",
              "#text": "https://lastfm.freetls.fastly.net/i/u/300x300/a4bd5cb7c9b497d912c43802a40ad380.jpg"
            }
          ],
          "mbid": "",
          "album": {
            "mbid": "",
            "#text": "What Came Before"
          },
          "name": "Mixed Emotions",
          "url": "https://www.last.fm/music/Chase+&+Status/_/Mixed+Emotions",
          "date": {
            "uts": "1650469597",
            "#text": "20 Apr 2022, 15:46"
          }
        }
      ],
      "@attr": {
        "user": "psprague",
        "totalPages": "32759",
        "page": "1",
        "perPage": "1",
        "total": "32759"
      }
    }
  }

Power Automate Flow

My power automate flow is generally the same as Loryan and Luise, with a few exceptions I’ll outline below.

As with the examples I started with, my flow runs every five minutes during business hours, M-F. “Get Tracks 2” pulls the response from Last.FM via my custom connection. Then, I parse the JSON.

Next, I’ve asked the flow to get the time 6 minutes in the future. Because Last.FM doesn’t provide time remaining in the track, I needed a general way to tell the flow to reset my status if I was NOT listening currently. Since the flow runs every 5 minutes, if I have gone 6 minutes without a new track, it will reset to a blank status. More on that in a minute.

Next, the flow grabs the parsed JSON body, and does some conditional rules. Last.FM does provide a “nowplaying” tag. However, I struggled to get the flow to properly apply the conditions that Loryan and Luise used (if “nowplaying” is equal to “true”, do this, etc.) This was largely a limitation from my lack of knowledge and skill. So, I’m leaning on the time expiration instead. As long as a new song is playing every 5 minutes, the flow will continue to update my status. If not, my status expires after 6 minutes.

It’s simple, inelegant, and I’m sure largely inefficient. But it was fun, and I’m glad I did it! Let me know if you have questions!

Mohican PowWow

I haven’t nearly had the time I’ve wished this summer to document and catch up with all of the shooting I’ve been doing. That being said, today’s shoot was a beautiful one. The Great Mohican Indian PowWow is an annual gathering of American indians from across North America. Dance competitions, demonstrations, food, crafts, the whole thing. But hands down, the most captivating part for me was the dancing. I’ve snagged some still-frames from the video we shot today. Can’t wait to edit these clips. Enjoy.

MohicanPowWow 4MohicanPowWow 9 MohicanPowWow 8MohicanPowWow 16MohicanPowWow 7 MohicanPowWow 6MohicanPowWow 2MohicanPowWow 10MohicanPowWow 17MohicanPowWow 15MohicanPowWow 5MohicanPowWow 14

City Gates

Possibly my most proud moment in filmmaking to date. I loved working with CityGates on this opener for their conference. Concept was mine, script was written by Doug Cooper at CityGates. I directed and edited on this, and Melanie Sudar shot it.

We also had the pleasure of working with some great talent & locations. Big thanks to Jeff Steiner, Jenna Steiner, Brock Thompson, Ashland Eye Care, and Ashland Comfort Control.

Lastly, the beautiful voiceover work was done our good friend Kelly Knowlton. Yep, she’s an amazing musician and wonderful actress as well. And of course you can book her for your own voiceover needs.

For you gear heads, the nitty gritty:
Canon C100
Rokinon 85mm
Canon 50mm f/1.8
GoPro Hero3+
Edit in FCPX
Post in Magic Bullet Looks

City Gates

Every once in awhile, you come across an organization that you just click with. The City Gates Initiative is just that. And so, I can’t tell you how stoked I was to film this piece, let alone the tons more we have coming in the hopper.

City Gates is an amazing thrust, and you can get the full skivvy here: http://citygatesinitiative.org/in-action

Watch the first piece in the series here:

kyle + natalie

Kyle and Natalie came to me in a back door sort of way. Natalie works with my wife and we got arranged to videograph their reception that way. Since the two of them actually had a destination wedding on the beach in Texas, they held a great reception at a newly opened reception center here in Ashland, Ohio. Definitely a different and fun task just capturing the reception, but it was a blast. You can view a sneak peak of the evening’s festivities above.