<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1240251502728721&amp;ev=PageView&amp;noscript=1">

Apr 3, 2018 8:16:00 AM

Service integrations made easy – hello Logic Apps!

Ryuichi Okubo

Senior Consultant, Technology

For us software developers, integration with other services is one of the ever-repeating chores. We encounter this nowadays more often than before as the number of microservices grows while maintaining legacy systems still needs to happen.

Many times the integration with other services is not so straightforward. Sometimes they have complex APIs with unfamiliar technology and poor documentation, all the while communication with the maintenance team takes a long time via email or ticketing system.

When finally we’ve gathered an understanding of how the API works, we need to write a good amount of code and bear the burden of its maintenance for such a common task, which, in essence, is just connecting one service to another.

Azure to the rescue

Meet my favourite tool from Azure: Logic Apps, which essentially is a composite serverless solution. You can connect with 3rd party APIs via out-of-the-box connectors without writing a single line of code. If you use other Azure services such as database or storage, integrating with them is easy peasy with CRUD support and event triggers. Scaling is handled automatically and you need to pay only for what you use. Sounds pretty great, right?

Let’s get to know Logic Apps in more detail

I’ll present a practical example on how Logic Apps can be used.

Let’s say you’re working with a logger service, which sends daily logs as a CSV file attached to an email. You want to save it for later use, then analyse it and send an alert if there is something suspicious. Should you need to build all of that by yourself, the steps would be something like this:

  1. Build a server which accepts the CSV log file
  2. Write integration logic with storage service (after reading documentation)
  3. Write code to analyse the log
  4. Write integration logic with Slack API (after reading documentation)
Next, possibly the most difficult part you’ll encounter: you need to ask the logger service team to send the data to your own server, not by email like how it is currently doing.

Using Logic Apps, the logic flow would be the following:
  1. Setup trigger on receiving email with attachment
  2. Using storage connector, save the attached file
  3. Write code to analyse the log
  4. Using Slack connector, send alert if appropriate
Let’s take a look at how that logic would be created on the Azure portal
Notice that this also works as simple documentation by naming each function well.
Let’s dig deeper into each function.
One of the good things about Logic Apps is that they have many triggers to start the run. You can react on events, be it Twitter, Trello, Slack, Storage or HTTP post. Gmail integration is one of them, and it is connected by just clicking a button. Then set the criteria for which email should trigger the run.

Here Logic Apps saves the file in Azure Storage. Those “Attachments” and “Content” are automatically generated from the previous connector, in our case the Gmail connector. “For each” -loop is also automatically created, as “Attachments” can be multiple instances. We can also use some generic function like “utcNow()” for simple logic.

Next, the file is passed onto Azure Functions. This is the place where you write your own code to do your custom analysis of the log data. Now that all other integrations are ready-made, you can focus on writing state-of-the-art analysis code.

Let’s say the Analyse function responds with JSON, then the next step is to parse it. You’ll find a connector for that as well.ryuichi-image1
Our custom Analyse function tells us if there is something suspicious going on. If there is, post a message to a Slack channel and let people know the situation. The Slack integration is also just a button click. No need to read their API documentation.

That’s it! Even though this scenario is made for a demo purpose, I can imagine cases where you can apply a similar workflow; an event triggers a run, which takes data, processes & saves it, then reports the result. In fact, we have built several solutions using Logic Apps similar to this one for production use.

Here are some other connectors I’ve found useful:
  • Trigger on new file in storage
  • CRUD operation on database
  • Call other Logic Apps
  • Scheduled trigger
  • HTTP call and webhook

With these and many other connectors, and using custom logic by Azure Functions where needed, you can go quite far with little coding and maintenance.

Even though I focused on Azure specific tools, there are other tools which work in similar manner (eg. AWS Step Functions). The idea behind it all is applicable to many uses cases. Service integration should be a reusable commodity, enabling us developers to build a solution by composing multiple services and thus reserving focus on growing the client’s business.


P.S. We're looking for nice people with a 'get shit done' attitude to join our team at Columbia Road! Take a new leap in your career, we have open positions in all business areas. Send a message, call us, visit us — we'd be thrilled to hear from you!


See open positions


Subscribe to our Newsletter

Stay up-to-date what’s going on in digital commerce and Columbia Road. We’ll email you once a month with news, interesting articles and studies from the industry and the crème de la crème of our blog.