I wanted to try custom connectors and use them for something that helps me in my everyday life. I created Custom Connector for Spotify so that there is music playing in my home ever weekday at 6 am without touching the mobile. I do one hour yoga every morning and touch my mobile after 1.5h waking up. This helps me to reduces stress in my everyday life.

Now I don’t need to touch my mobile and put music – because touching the mobile might get me reading messages and getting information alarm. Using custom connectors I list available streaming devices for my Spotify account and then start music there automatically scheduled from Power Automate flow.

Creating custom connectors

There is good tutorial to create Spotify Custom Connectors from That API Guy. My work was delayed since I did not read this picture carefully and selected from the dropdown the Spotify instead of Generic Oauth 2.

I created three actions, which I only need two and the GetPlaybackState is only for testing.

Get Devices action

was easy since it is just GET request.

The response needed to be imported from JSON response from Spotify documentation and got the properties

Press the Import from sample and paste the copied sample there. Now this action was ready.

The Play action

Took me a bit more since I first did not realize how to add the query parameter from the Spotify Start documentation.

The device_id was not in the request body

And when creating request from sample it did not add the device_id, I needed to add it manually to the url as querystring

This way I got the query parameter in the request

Power Automate flow

The actual flow is quite simple once you have the Custom Connector working.

  1. Get Devices action does not need any parameters
  2. I have my home theater amplifier online, so I will recognize the correct device
  3. Then use Play action and give there device id, then the playlist string, which song and milliseconds where to start – index 0 is the first song and 0 ms is the beginning of the song

I have now working Power Automate scheduled which will paly music on my home every morning at 6am. If you are interested to know what I do every weekday at 6am, please read this translated post about stress prevention.