The course is part of this learning path
Creating a Logic App
Creating a Custom Connector for Logic Apps
Creating a Custom Template
The Microsoft Azure cloud offers many options for developers who want to build websites and services on Web Apps. Normally, the coding is done using proprietary Microsoft languages like C#, Visual Basic, and others. More recently Microsoft has made it easier for open source developers to use the IDE and language of their choice with support for PHP, Java, Node.js, and Go for server-side code. However, some web solutions may not require a complex programming language to meet the requirements, and that’s where Logic Apps comes in.
This course looks at some of the features and benefits of Logic Apps and examines the kinds of business processes that you can easily model. We will look at the wider topic of workflow and automation problems and then show you how to transform these into Logic App solutions. We will also look at the internal components that make up a Logic App, including triggers, conditions, actions, and standard connectors.
For connecting to third-party SaaS services, or even your own homegrown APIs, you will learn how to create a custom connector. You will also learn about rapid deployment using Azure templates.
- Implement simple automation and workflow using Logic Apps
- Model business processes as a series of conditions and actions
- Monitor Azure Apps, Office 365, or third-party services using triggers
- Connect to Azure services and other well-known third-party websites
- People who want to become Azure developers
- Non-developers who want to build point-and-click solutions
- Solution architects
- General exposure to basic cloud technology
- Familiarity with the Azure Portal
This is perhaps the most interesting part of the course as you will be able to connect your Logic App to any API using an open API, Swagger File, an open API URL or a Postman collection. Postman is a great browser-based tool for sending and monitoring HTTP requests for an API.
This Logic App will use Azure Cognitive Services to get a gauge of the user sentiment by reading their comments and then adding a rank from zero to 10, 10 being very pleased and zero being quite dissatisfied.
It's possible to create this particular Logic App without having to use a custom connector but we're going to do it with a custom connector so you can see how that's done.
As a precursor to this demo, I went ahead and activated the Cognitive Service for TextAnalytics. You can see the settings here. It's important to have a name for the service and to copy the key for access.
Another step I have completed ahead of time was to create this SharePoint site called Movie Reviews to store the title, review, and score. The idea is for the Logic App to automatically detect that a new movie review was added and to use artificial intelligence to get a sense of the user's feelings about the movie by reading their comments, calculating the sentiment value and updating the score column.
First, we need to create the custom connector and then we can use it in a new Logic App.
You will see three sections, General, Security, and Definition.
Notice that you can use either a REST API endpoint or the WSDL for a SOAP API. First I will download a prebuilt definition file for the custom connector from the source shown here. The Microsoft documentation has supplied the text from this link as a starting point. I'm just copying the text, pasting it into Notepad and saving the file with a .json extension. Let's go ahead and import the file. Here in the General section, you can upload an icon for the custom connector.
Next, let's look at this security section. Remember when we copied the key for the Cognitive Service? This is where we put that in for secure access. Here you have the authentication type and the API key values.
In the third part of the wizard, we have the Actions, Trigger, and References. Let's take a look at the Actions area. In the general section, you will see the summary and the operation ID which is DetectSentiment. Further down in the Request area, you will see that the POST verb is set up with a request URL shown. You can make adjustments to the payload that is appended to the request here by clicking on Body.
The final piece is just to validate the custom connector. You can see we have a green light so we're all set to go.
Now that we have created the custom connector, we can use it in a new Logic App. I've gone ahead and created a new holder here.
The first step we have put in is a trigger which detects when a new item is created in our SharePoint list with the movie reviews.
This next step will use our custom connector to the Cognitive Service which analyzes the comments. We've configured it to use the Review column of the list as the source text.
To add more functionality, we can create a for each loop to check all the reviews and add a sentiment rating for each one by updating the Score column in that list.
Okay, this Logic App is ready to run.
Now let's run the Logic App and go back to SharePoint. First, let's create some new reviews with some movie titles and few comments. We're leaving the score blank at this point.
And here we have the results. Each review has been given a score. You can see that the scores make sense based on the comments that I have entered. These scores came from the custom connector to the Microsoft Cognitive Service we created earlier
And that's it for developing custom connectors in Logic Apps.
About the Author
Derrick is a content contributor and trainer for Microsoft cloud technologies like Azure, Office 365 and Dynamics 365. He works across North America and Europe to help companies and organizations with these technology shifts. Before that he has worn many hats but prefers to wear them one at a time.
When he is not night walking during his travels, you can find him on a bicycle path or performing guitar solos to an imaginary audience in his basement.