The Microsoft MVP Summit is next week. I'm here at 6AM slaving away cracking on this Swagger API file so that we can all have the awesomeness of automatically submitting MVP timesheets with Microsoft Flow.
But really, who doesn't want automatic?!
- The MVP Contributions "timesheet"
- MVP Production API
- Custom Connection via Swagger
- Set up the Flow
- Future ideas
The MVP Contributions "timesheet"
The Microsoft MVP award is a recognition of our various activities throughout the previous year, and it is measured with both "reach" and "impact". So, at a minimum, we have to do timesheets. I really really don't like doing timesheets.
We really should be able to do this automatically.
Write a blog? Made a podcast? RSS -> Automatic.
Wrote a tweet? Automatic. (your MVP lead will probably have a chat with you about this)
IoT senses temperature change? What better time to log an entry!
MVP Production API and the MVP PowerShell module
The MVP program with contribution from several MVPs created a set of APIs for querying and posting our profiles, contributions and details. The starting point is here:
To call this API, we need two pieces of authentication - we need OAuth to Windows Live Account, and we need an API key from the MVP API. Follow the steps in the post and you'll end up with:
- an MVP Production API subscription, which gives you a primary and secondary Api-Key
- a MSA application with ClientID and ClientSecret
I want to note that there are existing work in a MVP PowerShell module
It works the same way, but because it doesn't remember your tokens, every time you run the PowerShell you need to login via a Live, get a token, then make the submissions and then when the PowerShell session finishes you lose everything. So while this helps with entering the details, but doesn't help you manage your OAuth token, it certainly isn't "hands free / automatic".
So we will do this, automatically, with Flow
Custom Connection via Swagger
I frequently sing praises for Jan Vidar Elven's blog post on custom connector.
I'm connecting a Custom Connection to Flow to help me manage the MSA account. This is an extension of his detailed blog post.
To be able to call the MVP API we will need a Swagger (OpenAPI file) to create a custom connection. After some struggling - I've got a working version of the swagger file here:
You can read this, but to use it - you need to replace line 35:
With your real subscription key from the API. You can use either the primary or the secondary.
Save the swagger file. We go into Flow.
Set up the Flow
Start in Flow - create a custom connector by Importing an OpenAPI file
For OAuth to work - the redirect URL from Flow must be allowed by this App
Return back to Flow Custom Connection
Create a connection
Setup the Flow to make your MVP Lead happy because now all your contributions are going to be automatically entered.
I'm triggering this but clicking a button - you can hook this up to HTTP Request, Schedule Timer, RSS Feed... etc etc
The entry in the MVP tool.
Running this Flow does not guarantee an MVP award. But it will keep your lead happy.
1. The Swagger File is generated from the MVP API tool, but underwent heavy modification. For the curious you can compare the original vs my modified version.
2. As far as I can tell, the Swagger file defines two security definitions (for MSA and ApiKey), but Flow's Custom Connection UI can only handle 1 security setup.
Which is why I moved the ApiKey into an internal parameter within the Swagger File.
If Flow Custom Connection can handle multiple Authentication settings, then we can improve this part of the Swagger.
3. In Posting new Contributions - there are several settings are are ref objects. ContributionType, ContributionTechnology (ContributionArea), and Visibility. These should be connected to a dynamic lookup value, so within Flow UI, we will see a friendly dropdown menu that allows us to select one of the friendly names.
There's always more to do, but there's also a time to stop, and publish this blog post.