Logic app is Microsoft’s answer for IFTT like service. For those who don’t know logic apps , we can develop a simple web app using just blocks of workflows and connectors. Microsoft provides some out of box connectors for example, if you want to send an email every time a tweet is posted then you can simply use twitter connector. In this tutorial we will create a simple Logic App in Microsoft azure. The task which we are trying to accomplish is to make the app to send an email when a new http request is posted.
Each logic apps works in the concept of Trigger and action. Here in our example
Login to Azure portal and click new + button and select Logic apps
Enter the app name and resource group details.
Once the deployment is successful you will see the notification
Once you open the new logic app from dashboard you will see the common triggers
For this tutorial I will select “When an HTTP request is received”
Click edit and enter a sample json message to generate the schema.
Sample json :
“subject”:”This is a test”,
“message”:”This is a test message”,
Once you enter this json sample the system will generate the schema for this message format and updates the trigger.
Generated Json Schema.
Click New step and add action
Action is what you want to do if the trigger situation occurs. Here in this tutorial, we have to send an email. Search for “outlook.com send an email” and choose the action
The consequent step will redirect you to authenticate the outlook.com email address which you intend to use. This will be the email from address.
Once configured the essential email fields has to be chosen. We are going to use the values received from the http post message.
Click Save. You have created a Microsoft Azure Logic app.
In the request section you can now copy the url for this logic app. You can use this URL to make http requests to trigger the email.
Now to send out an http request I will be using https://www.hurl.it/ website. It is simply an online tool to initiate http requests to the urls.
Copy the logic app url and paste it in the hurl.it website and add the header parameter “content-type” to json.
In the request body you can input a sample json to test the logic app. Click launch request. This will initiate a post request to our app and in turn trigger the email connector.
In the azure dashboard you can see the request which we made is logged and the status is displayed on the page.
This successfully sends the email to the to address.