Tobias Wright

Technical Evangelist, Microsoft for Startups

< Home

Syndicating Medium post with Azure Logic Apps


In full transparency, I want more out of Logic Apps (which is the same as Microsoft Flow, but Flow is more UI friendly - also at first blush it seems to be an IFTTT clone, but I’m not so convinced now), it was always hard for me to find a good use for them. That is until I found there’s no easy way to display my Medium post on my website. There are ways I could have brought the posts in, most likey using just Functions, but I didn’t want to do it the same way again, so why not try something new. Enter Logic Apps.

Problem: Bring in the RSS feed from Medium and sydicate it to my site

Tools: Azure Logic Apps, Azure Functions, Azure Blob Storage, Javascript

Requirement: I don’t want to have to think about this again. Ever.

Here’s a quick wireframe of the first version.

Logic Apps Wireframe

There were a couple of problems with this. First. It only checked the RSS feed when something was added. So what if I wanted to delete a post or update a post? I’d have no other way to update the feed.

Also, my final step was an Azure Function, which really makes no sense since Functions are essentially a passthru, and I can always save straight to CosmosDB as apart of Logic Apps, especially since after collecting the RSS feed it ransforms it to JSON.

Here’s what I came up with next:

Logic Apps Wireframe

So a few changes here. I decided that I’d still kick off the Logic App on update, but I’d grab the whole feed as the next step. Now any updates would be included when adding to the feed. Still need to add an item to kick that off though. I’ll fix that in the next version.

I also end the Logic App with saving to CosmoDB and updating a record with the feed download. I’d figure I create an Azure Function to pull the feed in my site with javascript.

Almost there I think…

Logic Apps Wireframe

I decided to switch out the kick off on new add and just check the feed once a day. cool. Also, I switched out CosmoDB to Azure Blob. Blobs are cheaper, and I don’t really need the overhead of a NoSQL database. A data dump is fine.

Logic Apps Screenshot

You’ll notice a couple of changes. One, I found that I couldn’t jump right blob storage for some reason, it wanted to evalute every item in a for-each loop. I found the easiest way is just to use a compose connector and capture the body data - aka the feed.

Also, I wanted to do some defensive coding by making a fallback if the blob does not exsist, but it does assume you have a container called medium. I don’t see a way to create a blob container. Remember when I said I want Logic Apps to do more?

Okay, so here’s the Logic App Code.

Here’s the Azure Function I used to grab the contents when I make the ajax call from the site.

Here’s the javascript I’m using to make the call.