In this article, we will learn about how to create custom connectors for Azure Logic Apps.
A connector allows the Logic App to communicate between different services. There are around 325 and above connectors available to connect to Microsoft and non- Microsoft services. Sometimes we need to create and share our own connector with its own triggers and actions which are known as Custom connectors.
Create a Custom Connectors for Azure Logic Apps
There are several ways to create a custom connector to establish a connection between your own services and Azure Logic Apps. In order to create a custom connector, we need to describe the API that we need to connect so that the connector is able to understand the API’s definition and its data structure. We are able to create the definitions required for a custom connector using Wizard, Postman Collection or using OpenAPI definition to describe the services.
We can also use REST API as well as SOAP API to create custom connectors using the above two methods.
In addition to the above mentioned method, we can also create custom connectors using Wizard. In this demo, creating a custom connector via Wizard is described. In order to create a custom connector for Logic apps, we need to start at least a basic OpenAPI definition or Postman collection.
- An API key for the service (Text Analytics API is used for demo purpose).
- Make sure you have access to one of the following power platform services:
1. Power Automate
2. Power Apps
Create a Custom Connector via Wizard
- Start Navigate to link powerapps.com
- On the left navigation pane, Choose Data Custom Connector.
Select new custom connector and Choose create from blank.
Enter the name and click continue.
From this point, the steps are the same across all technologies.
Description– It is used to display the custom connector details and it is useful for others to get knowledge about the connector.
Host– Enter an address for the API service. The connector uses the host and the base URL to call the API.
Follow the steps given below to specify the authentication Type
- Security page Authentication Type API Key.
- Give meaningful information for parameter label, location and name. These values are displayed when someone first makes a connection with the connector. The field name and location need to match API expectations.
- Choose Connect.
Create the connector definition
Follow the steps given below to create a custom connector definition.
To describe a connector function there are a lot of options available in custom connector wizard. The first and foremost thing to do is creating an action that calls the API service.
Create an Action
- On the definition page, the left panel displays actions and triggers used for logic apps and also the reference that are used for the connector. Click New action.
- Add a summary, description and Operation id for an action that is currently selected in the general area that displays the details about the current selected action.
- Summary– Returns numeric score for the sentiment detected.
- Description– API returns a numeric score between 0 and 1. Here Text Analytics API used it return 1 for positive sentiment and 0 for negative sentiment.
- Operation Id– Any meaningful name usually begins with uppercase.
Request and Response
Request area displays information based on HTTP requests. In the Request area Click Import from sample. Use Microsoft official Text Analytics API documentation to get information to connect to the API and request body.
Response area displays response information based on HTTP requests. As similar to request. Use Microsoft official Text Analytics API documentation to get information to connect to the API and request body.
Check validation for any issue that is detected during defining an API. Once validation succeeded Click update Connector.
- In the Request areaChoose bodyEdit.
2. In parameter area, it expects three value i.e. Id, Language and Text.
3. Choose edit for individual value (language and text), Update value for parameter in schema area.
4. Once done Click update connector.
Test the Connector
Testing is available in power apps and we can easily test the created connectors to check whether it’s working properly.
- Choose a new connection on the test page.
2. Choose the API key and click Create Connection.
3. Choose a connector that we created from custom connectors and then go back to the test page.
4. On the test page, fill the input text field and click test.
5. The Response is displayed with the sentiment score by calling an API.
So far, we have discussed how to create a custom connector for logic apps, with this you should be able to call text analytics cognitive service through your custom connector.