Hi, I'm Nicholas 👋

I'm a Senior Platform Engineer

Buy Me A Coffee

Automate Social Media with Azure Logic Apps and an RSS Feed

Date published:

In this tutorial, I will be showing you how to add some automation to your social media applications using Logic Apps to post social media posts on a schedule from an RSS feed. The RSS Feed is useful if you would like to stay up to date with Azure latest updates.

First, we will be using the Azure update RSS Feed.

Azure Updates RSS feed: https://azurecomcdn.azureedge.net/en-gb/updates/feed/

The next thing we will do is create the logic apps resource. I have also selected the consumption plans, so it charges per execution. Once selected, click on a review to start building your Logic Apps.

Once created, click under logic app designer under the development tools section and click on Recurrence trigger as I would like to post at least twice a day.

When selected, I have opted to set my recurrence to 1 time per day, at 11 am and 7 pm UTC; the option At these hours and Time Zone.

After, we will need to get the data from the RSS feed URL by clicking on the next step below.

Search for RSS and click on List all RSS feed items

Paste the Azure RSS URL Feed above and leave the published set as the same

At this stage, you can click on the run trigger. Once completed, you will see some information below. Click on next time to proceed.

In this step, I have to ensure that body received is formatted as JSON otherwise, you will get lots of string data. We can select some of the RSS data into our social media item by providing a body. To start this, we will search for Parse JSON.

Next, we need to add the body to the content field shown below.

We will rerun the Logic app for this stage, copy the output from the body field, go back to the designer, and click on use sample payload to generate schema and paste it there. Once you have pasted it there, click on the done button.

It should look like this:

We can click save and rerun the logic app to generate the output for the JSON Schema.

Click on the Next step to proceed. We will use the Filter Array Action only to find the published posts based on the criteria. For this example, I will filter only post within the last two days by using the output of the body of the Parse JSON action and then filter it by the publish date.

I am using an expression subtract two days from today’s date. We will need to create value for it. When we click on the value field, go to the expression tab and addDays(utcNow(),2) and click on the ok button to select it.

Next, we can filter each item and send it out as a social media post. In this example, I will be posting it to Twitter and LinkedIn. Next, click on Find and Search for For Each trigger, select the body of the array, click on add an action, and search for post a tweet. Sometimes, you get prompted to log in to your Twitter account, so it allows access through logic apps.

Select tweet text and find a summary and primary link expression from the dropdown box.

After we can add a connection to it

At this stage, we will be adding LinkedIn to it. You can do this by clicking on add action, searching for LinkedIn and clicking on share an article, then signing into your account to grant access. Once added, add the primary link in the content URL field, and add a Title and the summary as the description.

To make sure the LinkedIn post is successful, if the Twitter posts were to fail for some reason, we should select the configure after run option. To do this, you will need to click on the three dots and select all the options.

The last thing is to run the trigger logic apps.

Here is my result

Twitter

LinkedIn

Reference: https://jonnychipz.com/2021/11/26/automate-social-media-posts-with-azure-logic-apps-and-an-rss-feed/