Azure Logic Apps - Post to Twitter


Azure FunctionsThe Azure Development Community uses a Logic App to post to Twitter when new blog posts are created.  This post takes a look at how this was implemented.

Overview

The final logic app is pretty straightforward and consists of a single trigger and action as shown below:

la1

Creating the Logic App

Starting with an empty designer, an RSS trigger is supported that detects when a new post is published:

la2

Configuring the trigger is pretty straightforward as only the URL and interval are required:

la3

The next step is to add an action to post to Twitter:

la4

The initial setup requires signing in to Twitter to authorize the Logic App to have access to post to Twitter:

la7

After authorization has been granted, text in the tweet is specified by selecting content from the previous step (blog entry). Below shows both Feed title and Primary feed link being selected and illustrates the additional content that is available.

la5

That's it!

Exploring the Logic App

The following looks into different aspects of running Logic App.

Health

Viewing a Logic App in the portal immediately provides some really helpful information.  In the Essentials section, we have basic information as well as a summary of the definition (1 trigger and 1 action), the current status, and a summary of the last day of activity.

la8

There are also several charts.  The first is a summary of the runs (re., when the trigger condition was met) and includes the status, start time and the duration.  In the example below it looks like the logic app is taking about 1/2 second to complete.

la9

An interesting thing to note is after the initial setup was working (1/20/2017, 2:14 PM), the next tweet failed (1/21/2017).  The chart provides a great way to trouble shoot the error.  First the failure is selected which provides a view of the failed run:

la14

By selecting the failure (clicking the red !), the issue is because Twitter responded with an Unauthorized code.  See the Twitter section below for more information.

la15

Another useful chart is the Trigger History showing the app is running every 10 minutes:

la12

And the Billable executions in the past month showing a daily activity of both billable triggers and billable actions.  Note: In the image below a single day is being hovered over to illustrate the dynamic chart.

la13

Twitter

The failed runs are interesting as the configuration did not change but the initial runs failed with an unauthorized response from Twitter. In investigating the error, the authorization was viewed by logging into the Twitter account and going to the Settings.

la10

In the Apps tab the applications with access to the twitter account are shown.

la11

Alerts

In general the tweeting Logic App can be ignored except when there is a failure sending the tweet.  To notify that there was a failure an alert was created.  There are several places to add an alert and one is when viewing the Billable executions chart.

la16

There are many metrics that could be selected as illustrated in the image below.

la17

For the purpose of being notified of failures, an alert was created where Runs Failed was great than 0 as shown below:

la18

Pricing

Determining the cost of running the Logic App is straightforward. From the Pricing page, we can get a understanding of how the pricing model works for logic apps and does vary per region.

The key is determining the number of executions. As we determined from the Billable executions in the past month report, we average around 144 executions per day. Roughly that is mostly the first step checking if there are new blog posts every 10 minutes (6 per hour per day = 6 * 24 = 144). If we round up to 150 and take a 30 day month, we can use 4500 as a monthly total of executions which puts us all within the $0.0008 / action billing range for a total of $3.60 per month.

Comments (2)

  1. Sjoukje Zaal says:

    Great start on creating a Tweet with Logic Apps!

  2. Mike-EEE says:

    EXCELLENT post and even introduction to Logic Apps, Jeffrey!

Skip to main content