Post

Automating RSS Feed Posts to Twitter(X) and Mastodon Using Logic Apps

Introduction

In today’s digital age, social media platforms have become essential tools for reaching and engaging with audiences. Twitter and Mastodon, in particular, are popular platforms for sharing updates and content. However, manually posting updates across multiple platforms can be time-consuming and inefficient. In this blog post, we’ll explore how to automate the process of posting RSS feed updates to both Twitter and Mastodon using Microsoft Logic Apps.

What are Logic Apps?

Microsoft Logic Apps is a cloud-based service that allows users to automate workflows and integrate various applications and services. With Logic Apps, users can create workflows, or “logic,” that connect different systems and services, enabling seamless automation of tasks.

Automating RSS Feed Posts

One common use case for Logic Apps is automating the posting of updates from an RSS feed to social media platforms like Twitter and Mastodon. By creating a Logic App workflow, you can monitor an RSS feed for new items and automatically post them to your Twitter and Mastodon accounts.

Here’s a step-by-step guide on how to set up this automation

  • Create a new Logic App

    Start by creating a new Logic App in the Azure portal. Choose a name and resource group for your Logic App.

    1. You can create a logic app from the Azure portal, just follow this Microsoft Documentation
    2. You can also create a Logic App using cmd, please update the values accordingly
    1
    2
    
    az group create --name testResourceGroup --location westus
    az logic workflow create --resource-group "testResourceGroup" --location "westus" --name "testLogicApp"
    

  • Trigger: RSS Feed

    Add the RSS trigger to your Logic App workflow. Specify the RSS feed URL you want to monitor for new updates.

    1. Add an RSS trigger, we will be using this RSS connector
    2. Fill in the values in the trigger, In the image below I have set the sync time daily you can change this according to your needs. trigger rss

  • Action: Mastodon - Create a toot

    Add the Mastodon action to create a new toot (post) whenever a new item is detected in the RSS feed. You’ll need to authenticate with your Mastodon account and provide the content for the toot, including dynamic fields from the RSS feed item.

    • Get your API key

    Head over to your Mastodon server, go to settings, and then Development. For example, this is what the URL looks like on mastodon.social

    • Create a New application and set the following:

      • Application name: Automation
      • Application website: https://www.yourblogposturl.com
      • Redirect URI: leave alone
      • Scopes: uncheck everything except - write:statuses
      • Save changes

  • Add an HTTP action

    we will be using this HTTP Action

    • URL: https://mastodon.social/api/v1/statuses?access_token=YOUR_KEY_HERE
    • Method: Post
    • Content-Type: application/x-www-form-urlencoded
    • Body: status=Your message goes here

mastodon-toot

  • Action: Twitter - Post a tweet (Only Works with X Enterprise)

    Configure the Twitter action to post a tweet whenever a new item is detected in the RSS feed. You’ll need to authenticate with your Twitter account and provide the content for the tweet, which can include dynamic fields from the RSS feed item.

    • Get Your App Secrets
      • Go to the Twitter developer dashboard
      • Go to Projects & Apps and select either the default app or create a new app
      • Go to Keys and Token Tab
      • Get the Consumer keys
      • More information can be found here
    • Creating an OAuth Client Application on Twitter

      To create your own Twitter OAuth client application, you’ll need to first sign in to https://developer.twitter.com. Navigate to the “Projects & Apps” section which is where you can manage and create Twitter applications. This process is explained in Twitter’s Twitter Developer Guide.

      After creating the Twitter app on the developer page following steps are required for proper setup:

      • Select your Twitter app
      • Edit app permissions to enable read and write.
      • Edit authentication settings
        • Add “https://global.consent.azure-apim.net/redirect” for the callback URLs
        • Set “Website URL” (required field, but its value does not affect the flow)

  • Add an action

    we will be using this Twitter Connector

    • Search for X and select Post a Tweet action
    • Fill in the following information
      • Connection Name: Twitter
      • Specify the Client ID and Client secret values from your application. (Use the API key and the API key secret of your Twitter app)
      • Click Connect and it will open a popup
    • Now add a tweet text

  • Save and test your Logic App

    Once you’ve configured the workflow, save your Logic App and test it to ensure that new RSS feed items trigger posts on both Twitter and Mastodon.

    logic-app

Benefits of Automation:

Automating the posting of RSS feed updates to Twitter and Mastodon using Logic Apps offers several benefits:

  • Time savings: Eliminate the need for manual posting and free up time for other tasks.
  • Consistency: Ensure that your social media accounts are regularly updated with new content from your RSS feed.
  • Reach: Reach a broader audience by automatically sharing content across multiple platforms.
  • Customization: Tailor your posts for each platform and leverage dynamic content from the RSS feed.

Conclusion:

Automating the posting of RSS feed updates to Twitter and Mastodon using Logic Apps is a powerful way to streamline your social media workflow. By automating repetitive tasks, you can save time, maintain consistency, and reach a wider audience with your content. With the step-by-step guide provided in this blog post, you can easily set up this automation and start reaping the benefits today.

This post is licensed under CC BY 4.0 by the author.