Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
Luke_C
17 - Castor

If you’ve ever found yourself refreshing the page on a Monday morning waiting for the latest Weekly Challenge to be posted, or you totally forgot to do the latest challenge all together, this article is for you! We will explore two ways to leverage the Community’s RSS feeds to automatically send Microsoft Teams messages when a new challenge is posted.

 

Luke_C_0-1676402102686.png

Automated Teams message

 

RSS Feeds

 

You’ve probably seen buttons or links to RSS Feeds on nearly every website you’ve interacted with, but have you actually ever used one?

 

RSS stands for ‘RDF (Resource Description Framework) Site Summary’ or ‘Really Simple Syndication.’ It is a web feed allowing users and systems to gain access to updates in a standardized XML format. It provides an easy way to build automation around content being released on your favorite websites.

 

For the Weekly Challenges, the RSS Feed can be accessed by going to Options>Subscribe to RSS Feed. You can see that each challenge post appears as an ‘<item>’ in the XML schema and contains the title, link, description, and published date (among other things).

 

Luke_C_1-1676402102800.png

Navigating to Alteryx’s RSS Feed page

 

Putting the RSS Feed to Work

 

So, this RSS Feed updates with every challenge post--now what?

 

Source: Giphy

 

If your company uses Microsoft Office 365, you likely have access to Power Automate. Power Automate’s capabilities complement Alteryx in many ways, and there’s even a Power Automate Tool available in the Gallery! There are a few pre-built RSS flow templates that you can get started with in a matter of minutes:

 

  1. Power Automate using your Microsoft account at https://make.powerautomate.com/.
  2. Click ‘Create’ and ‘Start with a Template:

 

image006.png

Power Automate Create page

 

  1. Filter by RSS and Microsoft Teams, and choose “Post message on Teams when a RSS feed is published. This will take a second to load your account information, and then you can click ‘Next.

 

image008.png

Available Flow Templates for RSS and Teams

 

  1. A pre-generated Flow will appear, and you can begin to populate the boxes with the relevant information:

image010.png

Example Populated Flow Template

 

From there, saving and turning on the flow will automatically result in the latest challenge information appearing in your Teams channel every Monday. That was straightforward, right?

 

Source: Giphy

 

The first week I enabled the automation, I was surprised to receive two messages. One for the current challenge and one for the previous week’s challenge. This is because when the solution files are posted in the previous week, the RSS Feed’s published date updates for the post, which triggers the automation. There are a number of ways to solve for this; I chose to log the challenge titles in a SharePoint list and validate that the new RSS feed post hasn’t been processed before.

 

Here's an example of what that might look like:

 

image013.png

Example SharePoint List layout

 

The first update is to get the most recent entry in the list by adding a ‘Get Items from SharePoint’ step, sorting by created date, and getting the 1st item (much like using the sorting and sampling tools in Alteryx). 

 image015.png

Added step to get the latest list item

 

While we’re making updates, I suggest adding an ‘Initialize Variable’ step to create a hyperlink to the challenge to add to the Teams message. This consists of wrapping the link returned from the RSS feed in the HTML syntax for a hyperlink. We’ll use this later.

 

image017.png

Creating Hyperlink for Teams message

 

The next step is to add a condition to check if the RSS feed’s title is equal to our SharePoint List’s latest challenge. If it isn’t, it will assume it’s the new challenge and send the message. If it is, then it’s most likely an update being made to a previous post. In the below screenshot you can also see the ‘Link’ variable added to the message text:

 

image019.png

Adding conditional check for old challenges

 

The very last step is to write the title to the SharePoint List to be used in the following week:

 

image021.png

Writing this week’s challenge title to SharePoint

 

After all that, you and your team should receive the latest challenge information right in the Teams channel every week without you giving it a second thought!

 

Source: Giphy

 

Now, you may be thinking, “can’t we do this all in Alteryx?”. Yes, of course an Alteryx workflow can be leveraged to achieve a very similar effect. I chose Power Automate for my use case primarily because it monitors the RSS Feed automatically and plays nicely with the HTML returned in the RSS Feed.

 

To leverage the same effect in Alteryx, it will require a few additional steps:

 

image024.png

Example Alteryx workflow

 

Text Input: this will house the RSS Link and your Teams webhook link.

 

image026.png

Text Input configuration

 

Generate a Teams webhook by selecting the ‘Connectors’ option on the channel you want to post to:

 

image028.png

Teams Connectors

 

Select ‘Configure’ Incoming Webhook to set up the connection, name it, and retrieve the link. Treat the link like you would any other security token. You don’t want your Teams channel to be bombarded with spam!

 

image030.png

Incoming Webhook Configuration

 

Download Tool: Pass the RSS link through as the URL.

 

image032.png

Download tool configuration

 

XML Parse Tool: Pass the ‘DownloadData’ through to return the child details:

 

image034.png

XML Parse tool configuration

 

Sample Tool: Take the first record (latest post)

 

Join Tool: This will join a .yxdb file mimicking the SharePoint List functionality mentioned above. The .yxdb file is updated at the end of the workflow. If data passes through the ‘L’ output of the join, it assumes it is a new challenge post.

 

Formula Tool: This tool will be used to write JSON that will create the Teams message:

 

'{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "a summary",
    "sections": [{
        "activityTitle": "'+[title]+'",
        "activitySubtitle": "",
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "ActionCard",
        "name": "Visit",
        "actions": [{
            "@type": "OpenUri",
            "name": "Complete the Challenge!",
                "targets": [
                    { "os": "default", "uri": "'+[link]+'" }
                ]
        }]
    }]
}'

JSON for Teams webhook

 

Download Tool: Set the Teams webhook field as the URL and configure a POST request on the Payload tab using the JSON field we just created:

 

image038.png

Send Teams Message

 

Select & Output Tool: Append the Weekly Challenge title to the .yxdb for future use.

 

Your Teams channel should have a message that looks like this:

 

image040.png

Alteryx generated Teams message

 

It’s worth noting that the webhook functionality does not support HTML, so it is not straightforward to pass the challenge description through to the message. If you’re feeling up for a challenge, you would need to parse the HTML into Markdown in order for it to work in a similar way to the Power Automate solution.

 

I hope you’ve found this blog helpful! This is a great way to keep internal user groups engaged. While this blog focused on Teams, I’m sure there are ways to integrate with other popular messaging tools such as Slack. I’m also curious to see what tools people come up with to leverage the RSS Feeds in other parts of the community!