+44 (0)115 933 8474 hello@n4stack.co.uk

Earlier this week we had a session at the office with April Edwards from Microsoft about Azure Logic Apps;

 

While this is something I had been aware of before it is something I had never seriously looked at. After the session had finished I decided to have a quick play and ended up creating an application where I ended up having to troll myself on Twitter to test it.

While Logic Apps are a quite simple concept, they do allow you to build surprisingly powerful applications from the comfort of the Azure Portal. However, my application was not going to be complex. It would search Twitter for a keyword, which would be my Twitter handle, take the content of the tweet and pass it through the Azure Cognitive Service to discover the sentiment of the tweet and then, depending on the results, posts it to a Slack channel as either Happy or Sad.

After connecting my Twitter and Slack accounts and generating API keys for the Text Analytics part of the Azure Cognitive Service, I moved on to the Logic App designer. Here I built the application, a full version of which can be found below;

Azure Logic App

 

As you can see, with a few simple boxes I was able to build my application with no problem at all. The following steps are performed each time the Logic App is called;

  • Checks for any mentions of “russmckendrick” on Twitter. If there is one it collects the details of the tweet (don’t try changing the mention to something like “trump” – you get a lot of results!)
  • The content of the tweet is sent to the Azure Cognitive Service where it is analysed and given a score which represents the sentiment of the tweet. The scores ranges from 0 to 1, with 0 being negative and 1 being positive.
  • Once we have a score we can route the tweet to Slack. If the score is 0.4 and below it’s classed as “Sad” and a message is posted by “Sad Bot”. If the score is above it’s classed as “Happy” and is posted by “Happy Bot”.

 

Once the application was built it was time to test it. As I had just got into the office I decided to complain about my lack of coffee;

 

Once I had a cup of coffee I congratulated myself;

 

However, I wasn’t impressed when I had finished it;

 

Within a few minutes of posting each tweet the Logic App had found the tweet, detected the sentiment and posted as the correct bot in the demo channel we have;

Azure Logic App

 

While it took a minute or two to execute, this was only because the interval was set to three minutes, the Logic App itself took less than a few seconds to execute.

So, what was the point of this?

Well, engaging the wider business and being able to demonstrate how Azure services such as Logic App and Cognitive Services work and bring value is absolutely key to innovation. This project can be replicated quickly and using social media sentimental analysis as a use case, it is something the whole business can identify with and understand. Already in our business this has spawned lots of ideas on how Logic Apps and Cognitive can be applied to more complex use cases and improve our client experience.

Russ McKendrick

Russ McKendrick

Practice Manager (SRE & DevOps)

Russ heads up the SRE & DevOps team here at N4Stack.

He's spent almost 25 years working in IT and related industries and currently works exclusively with Linux.

When he's not out buying way too many records, Russ loves to write and has now published six books.

To find out more about Russ click here!

Share This