Christian Reddington

Ideas and Technology :: This blog represents my own views

Integration Platform as a Service: Logic Apps

August 12, 2016 in #Logic Apps #Azure #Dev #Cloud | | | Share on Google+

In case you had not already heard, Logic Apps have now reached general availability on Azure (or read an MSDN article by Jeff Hollan on the topic).

What are Logic Apps?

Logic Apps enable integration points primarily between Software as a Service (SaaS) offerings and can be easily configured through a User Interface, available on the Azure Portal. This integration is facilitated by using a series of connectors, which are focused onenterprise integration (in Public Preview at the time of writing) and SaaS applications such as SalesForce, Twilio, Office 365, Twitter and more (though it's worth noting that some of these are in beta!)

By the way, if you have some feedback for the Logic Apps team, there is an excellent mechanism for feeding it back via the Logic Apps UserVoice page.

Let's run through a quick example

The cloud is rapidly evolving, and there is a lot of information to digest continously. In this example, we will build a Logic App that detects a new post on the Azure News RSS feed and texts relevant details to a phone number via Twilio.

In case you are unaware, Twilio is a service that provides APIs for Telephony-based interactions, e.g. Voice and SMS. For this demo, I have used the free API key offer provided by Twilio. However, because you are using this free trial - You are limited to sending messages/calls to only verified numbers.

Firstly, head over to the Azure Portal, and open up the Create logic app blade.

Create a new Logic App

Once you have entered the relevant details, go ahead and create the resource. Once created, navigate to it through your Azure Portal. A blade similar to the below should be displayed. We will opt for the "Blank LogicApp" option, so select that.

Logic App Splash Screen

The Logic App designer will then load up for you. The designer is an interactive canvas, which allows you to generate the flow of your Logic App. Let's begin by searching for the RSS connector, and selecting that.

Logic App Designer

Great. We have added the RSS connector as our trigger point. We can add another step to our flow, and create an action upon detection of a new post on the RSS feed. This process feels synonymous to designing a computer program. In fact, there are a few options that we have here:

  • Add an action
  • Add a condition
  • Add a for each
  • Add a do until
  • Add a scope

Very much, like a computer program! We're going to keep this simple and click "Add an action", and search for the "Twilio - Send Message" connector.

Creating an action in Logic Apps

You should now have a view similar to the below. We have a few options that we need to configure:

When a new feed item is published

Send Message

  • Connection Name: myTwilioConnector (This is not related to your Twilio API access, so you can name it something appropriate to your Logic App)
  • Twilio Account ID: In your Twilio Console, this will be the "Account SID".
  • Twilio Access Token: In your Twilio Console, this will be the "Auth Token" field which is hidden by default.

Once you have entered these details, click Create.

Creating an action in Logic Apps

The Twilio connector details will update, assuming that your authentication credentials were correct. Now you will need to enter some further details:

Send Message

  • From Phone Number: This is the number that Twilio has provided, and is populated automatically in a drop down box.
  • To Phone Number: This is the number that you would like to send the message to (Remember, that if you are using the free trial - You will need to follow the steps on Twilio to validate this number).
  • Text: Type in the message that you would like to send. Take notice of the Outputs below the message box, that are available from the RSS connector.

Once you are happy, save the Logic App in the top left-hand corner of the screen. Congratulations, you have just created your first logic app!

Configure the Twilio Send Message option

You may be interested to see what is happening in the background. While you are using the UI, a JSON document is being updated, which reflects the template of the Logic App that you are creating.

Configure the Twilio Send Message option

You will notice a couple of variables relating to connectors, e.g. @parameters('$connections')['twilio']['connectionId']. You will also notice new resources in the same Resource Group as the logic app that you created, which match these references.

Configure the Twilio Send Message option

We have built an incredibly simple logic app, serving solely one user. While it is basic, it demonstrates the simplicity of the technology. Additionally, we have triggered this Logic App based upon detecting a new post in the RSS feed. We could do this in numerous approaches, as documented here. However, I hope that this has been useful and that you have created something useful for yourself in the process.

Logic Apps is a topic that I will be exploring further, so stay tuned for further details and more detailed examples!

August 12, 2016 in #Logic Apps #Azure #Dev #Cloud | | | Share on Google+