How to roll your own rss2twitter bot in 15 minutes in Azure?


For today I’ll show you how to roll your own rss2twitter bot in about 15 minutes. What will this bot do?

  • Check an RSS feed for new entries
  • Parse the new entry and replace key words with hashtags
  • Post it to twitter

For this we’ll be using ;

  • Azure Function : as the customer code to find/replace certain words
  • Logic App : as the tool to create our process via a visual tool

And in the end, we’ll see something like this ;



Azure Function

First we’ll start by creating the Azure Function. Use a generic webhook for this ;


And create your function ;

module.exports = function (context, data) {
    context.log('Webhook was triggered!');

    context.log('Data = ' + data["feed"]);

    var feed = data["feed"];;

    var mapObj = {
        'stream analytics':'#streamanalytics',
        'big data':'#bigdata',
        'application gateway':'#applicationgateway',
        'internet of things':'#iot',
        'sql server':'#mssql',
        'visual studio team services': '#vsts',
        cloud: '#cloud',
        paas: '#paas',
        iaas: '#iaas',
        saas: '#saas',
        blockchain: '#blockchain',

    var re = new RegExp(Object.keys(mapObj).join("|"),"gi");
    feed = feed.replace(re, function(matched){
        return mapObj[matched.toLowerCase()];

    var body = feed;

    context.log('Replaced = ' + body);

    context.res = body;



Azure Logic App

We’ll create a LogicApp by starting from a blank template ;


Next we’ll choose “RSS – When a feed item is published” ;


Here we’ll enter the url and how often we want to check this. Bare in mind that you’ll pay a small fee per logic app run. So doing this every minute we’ll cost more than doing it once a day. The pricing is low. Though nevertheless, you should always take this into consideration!2017-02-08-19_21_10-logic-apps-designer-microsoft-azure

Next up, we’ll integrate our Azure Function ; 2017-02-08-19_21_18-logic-apps-designer-microsoft-azure 2017-02-08-19_21_36-logic-apps-designer-microsoft-azure


The function is a web hook and will expect a json payload as input. So be sure to format your input like this! For this example, I’m sending the content of the “Feed title” from the RSS entry to my Azure Function.


Once done, we can link it to our twitter ;
2017-02-08-19_22_21-logic-apps-designer-microsoft-azure 2017-02-08-19_22_35-logic-apps-designer-microsoft-azure


Now we can post a tweet by using the result of our function (the parsed feed title) and the link of the RSS item.



Now we’ll take this out for a test spin… An example flow is to check the RSS feed of the Azure blog and post it to a twitter account @AzureInspired ;


And yes… this flow does what it is expected to do! 😉



Closing Thoughts

  • Yes, this bot is generating even more spam on twitter! 😀
  • The creation of this bot was done in less than 15 minutes. Try it yourself…
  • This example shows how easy it is to set things up with Logic Apps.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.