Azure Logic Apps are a great way to accomplish a variety of integration in the cloud, like sending emails on some trigger or updating other systems via an API. There are already a variety of connectors available in Azure Logic Apps and additional connectors are added on a regular basis.
Today we would like to talk about HTTP – HTTP integration via Logic App as the middleware using Visual Studio 2017. We will talk about how we integrated two completely different systems via Azure Logic Apps and Function Apps, Insightly (CRM) and Maconomy (ERP).
- Open Visual Studio. On the Tools menu, select Extensions and Updates.
- Expand the Online category so you can search online.
- Browse or search for Logic Apps until you find Azure Logic Apps Tools for Visual Studio.
- To download and install the extension, click Download.
- Restart Visual Studio after installation.
First, we created an empty logic app so that it would give us the endpoint that is required to be called from Insightly. Then we go into Insightly settings and created a web hook for the logic app endpoint, to be triggered on events, for example on Project Creation.
We then create a function app that will manipulate the payloads coming from the API request invoked via the Insightly web hook trigger. This allows us to take those payloads and export the data to a totally different system, i.e. the Maconomy ERP.
The Logic App scaffolds the required HTTP calls and Function App calls in the required sequence. We also make use of the template deployment system in Azure, to be able to provide parameters required for the app in a separate JSON file.
After exporting the data to the Maconomy ERP, we can can use the same mechanisms to respond with a success message to Insightly. We can also update project instances in Insightly with any reference data which keeps the 2 platforms in sync.
Using the built-in connector by Azure Logic Apps to send an email, we add some basic error handling to provide notifications in the case of any errors in the process.
The extremely developer friendly part of the Azure Logic Apps are the detailed logs of each trigger of the app and the list of input and outputs to every step in the application execution process. These can help identify issues with very little effort.
In the Visual Studio project, we simply right click on the project, select the Azure account, subscription and the resource group for the Function App.
the Logic App requires parameters to be set for deployment, these were provided in an accompanying JSON file. If any of the required parameter were missing from the file, Visual Studio would just prompt and ask for the missing parameters. With the file in place, again we simply right click and select deploy from the context menu on the project in the solution.