Power Automate is a super cool tool, which gives us a lot of options. But sometimes, the built-in connectors, are not enough. In one of previous posts, I showed you how to send HTTP requests to Microsoft Graph API. This time, I will show you how to connect to APIs outside of Microsoft 365 in Power Automate and even use an IOT button to trigger your flow.
To make things more approachable, here is a little use case for you:
I want to Select an IOT button and this shall trigger a flow which tweets about the music I currently listen to on Spotify.
The result will look like this:
To achieve this, we will need a couple of things:
I use a Flic IOT button trigger my flow. This button works with Bluetooth, which means that we will need a Bluetooth enabled device to work with this button- either a smartphone or an IOT Hub.
Set up your IOT button
If you like to, rename this button - please keep in mind, that one button can be used to trigger several flows, as we have three different event types: Select, Double-Select and Hold.
In this flow we want to trigger by one or any event of the flic button and then tweet the song we are currently listening to on Spotify. Turns out, that there is no connector for Spotify, so why not building our own custom connector?
To be able to build custom actions, you will need an API for this service. Lucky us, that Spotify provides us with that API so that we can use this to build our custom connector.
Of course we need to have at least a free Spotify account so that we can listen to music that then shall be tweeted about.
Before we can build the connector, we will need to register for Spotify's Developer program. Once this is done, we can retrieve Spotify content such as album data, playlists and more though Spotify Web API. To get user-related data (like the song our user is playing right now) we need to authorize our application so that we are allowed to retrieve this information.
Register our application on Spotify
Log into your brand new Spotify for Developers account
Now go back to your Custom connector
Now it's time to build our flow
As already said, we want the flic button to be our trigger
You can choose, if you want this flow to be triggered by any event type or if you want to save the two other event types for other flows.
Now we want to get the current song from our shiny new Custom connector:
In this post I explained, how you can create a custom connector and call an API outside of Microsoft 365. You learned how to define actions and how to authorize your application so that you can retrieve the requested data. Which use cases do you have in mind? What would you like to build a custom connector for? Please share!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.