How to Create Custom Connector in Power Automate

How Do I Create a Power Automate Custom Connector Step by Step?

No comments

Loading

In this “Power Automate Custom Connector” article, we will learn about how to create a custom connector in Power Automate or Power Apps step by step and how to call it from Power Automate flow. And, also, we will learn what a custom connector is in Power Platform (Power Automate or Power Apps) and why we need it.

What is custom connector in Power Automate or Power Apps?

A Custom Connector in Power Automate and Power Apps is a powerful feature that allows users to create their own API-based connections when a pre-existing connector is unavailable or doesn’t meet their specific needs. This enables apps and workflows to interact with third-party services or internal APIs, providing seamless integration between external systems and Microsoft’s Power Platform.

Let’s understand it in a very simple way: while you are working on Power Automate flow and you don’t see the connectors you need for your work from any of the below categories, that means your expected connector is not available. So, in order to display your connector in the below list, first you need to create your custom connector. The custom connector gets displayed under the “Custom” tab.

List of connectors available in Power Automate
List of connectors available in Power Automate

Key Concepts of a Custom Connector:

  1. Extend Functionality: With custom connectors, you can extend Power Automate or Power Apps to communicate with APIs that aren’t part of the standard connectors library. This means you can connect to virtually any web service with an accessible API.
  2. Custom APIs: When a business has a proprietary or in-house API that doesn’t have a connector in Power Automate or Power Apps, you can build a custom connector to integrate that API with the platform.
  3. Authentication Support: Custom connectors can handle different authentication types like OAuth 2.0, Basic Authentication, and API Keys, ensuring secure connections to external services.
  4. Custom Actions & Triggers: You can define custom actions (tasks your connector can perform) and triggers (events that initiate workflows) to suit specific business needs.
  5. User-Friendly Integration: Once created, custom connectors can be used within Power Automate or Power Apps just like any other built-in connector, allowing non-developers to leverage them within their automations and apps.

Common Use Cases:

  • Integration with Legacy Systems: Connecting Power Automate with an internal legacy system API.
  • Custom APIs: Integrating Power Apps with proprietary APIs for custom workflows.
  • Third-Party Services: Connecting to niche services or platforms not covered by existing connectors in Power Automate or Power Apps.

Benefits: Why do we need a custom connector?

  • Flexibility: Provides more flexibility by enabling the Power Platform to interact with any service that exposes an API.
  • Reusability: Custom connectors can be reused across multiple flows in Power Automate or apps in Power Apps.
  • Scalability: As business needs grow or change, new actions or triggers can be added to custom connectors.

The custom connectors empower organizations to unlock more potential from Power Automate and Power Apps by integrating services and systems beyond the out-of-the-box options.

How Do I Create a Power Automate Custom Connector?

It is a two-step process; first we need to create or get the API key, then we need to configure this API in Power Automate or Power Apps as a custom connector. In this demo, we will work with the currency conversion custom connector, so first we need to register with the currency conversion API provider and get the key from there.

What is a Currency Beacon API Key?

The Currency Beacon API is a reliable, real-time exchange rate and currency conversion API designed to provide up-to-date foreign exchange rates for various currencies worldwide. It is widely used by developers to integrate currency conversion and exchange rate data into their applications, websites, or systems.

Key Features of Currency Beacon API:

  1. Real-Time Exchange Rates:
    • Currency Scoop provides access to real-time foreign exchange rates, updated regularly, ensuring accurate and up-to-date data for currency conversions.
  2. Historical Exchange Rates:
    • The API also provides historical data, allowing users to track and analyze currency trends over specific time periods.
  3. Multiple Currency Pairs:
    • Currency Scoop supports over 160 currencies, including major currencies like USD, EUR, GBP, and many others. It allows conversions between different currency pairs easily.
  4. JSON Responses:
    • The API returns data in a lightweight JSON format, making it easy to integrate and work with in modern web and mobile applications.
  5. Currency Conversion:
    • With Currency Scoop, you can perform quick and accurate currency conversions, helping users or businesses to calculate exchange rates dynamically.
  6. Flexible Plans:
    • The service offers various pricing tiers, including a free plan for basic usage, and premium plans with more advanced features like higher API request limits, historical data access, and guaranteed uptime.
  7. Developer-Friendly:
    • Currency Scoop is designed to be simple for developers to use, with straightforward API calls and comprehensive documentation, making integration seamless.

Common Use Cases:

  • E-Commerce: Automatically convert product prices to different currencies based on the customer’s location.
  • Travel Applications: Show exchange rates and conversions for different countries.
  • Financial Tools: Provide real-time exchange rate data for currency trading platforms or financial apps.
  • Global Payments: Calculate accurate conversions for international transactions and billing systems.

API Example:

A simple GET request to the Currency Scoop API might look like this:

https://api.currencybeacon.com/v1/latest?base=USD&symbols=EUR,GBP

This request would return the latest exchange rates for EUR and GBP relative to USD.

Advantages:

  • Accurate and Reliable: Powered by a robust infrastructure that ensures accurate exchange rate data.
  • Scalable: Supports a wide range of use cases from small-scale currency conversions to large enterprise systems.
  • Free Tier: Allows developers to start using the service for free with a limited number of requests per month.

The Currency Scoop API is an ideal solution for businesses and developers looking to incorporate up-to-date currency conversion and exchange rate information into their digital platforms.

Obtain A Currency Beacon API Key

Open the Currency Beacon website and sign for a free account.

Currency Scoop API Sign UP
Currency Beacon API Sign UP

Then, copy the API key, you will get it from your account dashboard.

Obtain Currency API Key from Currency Scoop
Obtain Currency API Key from Currency Beacon

Review the documentation of Currency Beacon API

To review the Currency Beacon API documentation, go this page – Global Currency Data API Documentation.

Currency Beacon API Documentation
Currency Beacon API Documentation

We will use this API call to convert the currency from USD to EUR:

https://api.currencybeacon.com/v1/convert?api_key=RNS0WkJdaNA63XeyQauIZrccZpcmmert&from=USD&to=EUR&amount=1

We we will get the response like below:

Response from Currency Beacon API - Currency Converter
Response from Currency Beacon API – Currency Converter

By now we are done with API setup; next, we will go to Power Automate to create a custom connector.

You can test your API using the Postman tool. Here is a very good step-by-step walkthrough article on how to test an API using the Postman tool: In 4 steps access SharePoint online data using postman tool

Create a custom connector in Power Automate: Create from blank

Login to your make.powerautomate.com or make.powerapps.com environment.

From the left side panel, click on the “More” menu, then click on Discover All. You will find the “Custom Connectors” link.

Custom Connectors in Power Automate
Custom Connectors in Power Automate

There are many ways to create a new custom connector as shown below:

Create custom connector in Power Automate
Create custom connector in Power Automate

I will go with the “Create from blank” option.

Basically, there are six steps involved in this process to complete the custom connector in Power Automate, as shown below:

Steps in custom connector configuration in Power Automate
Steps in custom connector configuration in Power Automate

Name your customer connector. I have named as “Currency Beacon”.

Create from blank custom connector in Power Automate
Create from blank custom connector in Power Automate

Click on the “Continue” button.

Upload the connector icon image which is an optional step.

Configure currency beacon API in Power Automate
Configure currency beacon API in Power Automate

In the above screen, the mandatory configurations are as below:

  • Scheme: HTTPS
  • HOST: api.currencybeacon.com
  • Base URL: /

Rest all you can keep as is.

Here is the sample API call format, and we need to understand where the value is coming from:

https://api.currencybeacon.com/v1/convert?api_key=RNS0WkJdaNA63XeyQauIZrccZpcmmert&from=USD&to=EUR&amount=1

Apply Custom Connector Security Settings

Click on the “Security” next arrow.

Following are the authentication types available:

  • No authentication
  • Basic authentication
  • API Key
  • OAuth 2.0
Authentication type in Custom connector configuration in Power Automate
Authentication type in Custom connector configuration in Power Automate

I will go with the “API Key” authentication type. Refer to the below screen for what and how to configure the security.

Configure Security in Power Automate Custom Connector
Configure Security in Power Automate Custom Connector
Field Value
Parameter label api_key
Parameter name API Key
Parameter location Query

We can relate the above table with the sample URL we have seen above:

https://api.currencybeacon.com/v1/convert?api_key=RNS0WkJdaNA63XeyQauIZrccZpcmmert&from=USD&to=EUR&amount=1

Click on the “Definition” right arrow link.

Configure Actions For Custom Connector

Click on the add “action” link and pass the operation ID; rest all keep as is, or you can pass the summary and description for this action as well.

Create a new action in Power Automate Custom Connector
Create a new action in Power Automate Custom Connector

Click on the “+ Import from sample” link from the “Request” section.

Select verb as “GET”.

URL as the URL what we have using the sample URL in this article.

https://api.currencybeacon.com/v1/convert?api_key=RNS9WkJdaNA53XeyQauIZrccZpcmmert&from=USD&to=EUR&amount=1
Import from sample in Custom Connector Action configuration
Import from sample in Custom Connector Action configuration

Click on the “Import” button.

Once we import, the screen looks like below:

Import from sample in Custom Connector Action configuration View
Import from sample in Custom Connector Action configuration View

Configure Query Parameters For The Currency Conversion Custom Connector

Once we import from sample query, we will see all query parameters like api_key, from, to, and amount. We need to setup each of the parameters. Starting by deleting the api_key parameter. It is not needed because we already added it in the security section. So, let’s start this setup.

Delete API Key Parameter in Custom Connector Setup
Delete API Key Parameter in Custom Connector Setup

Then, select “from” and click on the “Edit” menu.

Then configure all the required parameters, like name and whether it is required or not (select as required).

Configure from or base currency parameter in Custom Connector

Validation successful in Custom Connector Setup
Configure from or base currency parameter in Custom Connector

Similarly, configure the “To” currency parameter.

Configure foreign currency parameter in Custom Connector
Configure foreign currency parameter in Custom Connector

Then, finally, configure the base currency amount parameter.

Configure base currency parameter in Custom Connector
Configure base currency parameter in Custom Connector

Add A Default Response To The Currency Conversion Custom Connector

Click on the “+ Add default response” link to add a default response from the currency conversion API.

By the way, what is Default Response?

It defines the shape of response returned by the underlying connector when making the request.

Add default response to Power Automate Custom Connector
Add default response to Power Automate Custom Connector

In the body box, pass the sample API output we got at the beginning of this article; you can generate that by copying and pasting that sample currency conversion URL in your browser.

Configure default response to Power Automate Custom Connector from API Call
Configure default response to Power Automate Custom Connector from API Call

This is my sample response I got from the API call:

{
"meta": {
"code": 200,
"disclaimer": "Usage subject to terms: https://currencybeacon.com/terms"
},
"response": {
"timestamp": 1727012368,
"date": "2024-09-22",
"from": "USD",
"to": "EUR",
"amount": 1,
"value": 0.89562154
},
"timestamp": 1727012368,
"date": "2024-09-22",
"from": "USD",
"to": "EUR",
"amount": 1,
"value": 0.89562154
}

Click on the “Import” button.

Save The Currency Conversion Custom Connector

Click on the “Create connector” link to save it.

Create connector in Power Automate for Custom API
Create connector in Power Automate for Custom API

This takes a couple of seconds to complete the saving process as it updates the swagger file. Once it is successfully saved, you can see the “Update connector” menu.

Create connector in Power Automate for Custom API completed
Create connector in Power Automate for Custom API completed

Transform The Custom Connector Response With C# Code (Optional Step)

This step is optional. ​Custom code transforms request and response payloads beyond the scope of policy templates. You can either paste in your code or upload a file with your code. Your code must be in C#, have a maximum execution time of 5 seconds, and can’t be more than 1MB.

Transform The Custom Connector Response With C# Code
Transform The Custom Connector Response With C# Code

Test The Currency Conversion Custom Connector

Before we use this custom connector either from Power Automate or Power Apps or from any application, it must be tested locally first. So, let’s test this connector here.

Switch to “6. Test” mode, then click on the “+ New connection” link to create a new connection as we have configured the authentication type as API Key.

Create new connection in Power Automate custom connector
Create new connection in Power Automate custom connector

Enter the API key you got from the Currency Beacon website.

Create connection with API Key in Power Automate custom connector
Create connection with API Key in Power Automate custom connector

Click on the “Create connection” button.

Notes:

  • I was facing an authentication issue, so I have created another new custom connector from the blank template, which worked perfectly. So, in the new custom connector, the parameter name, description, or label may be different than the above screenshots, so don’t get confused; the process is the same.

Below I am showing the complete screenshots of the new custom connector, which is working perfectly.

General Information:

Power Automate Custom Connector General Information
Power Automate Custom Connector General Information

Security Configuration:

Power Automate Custom Connector Security Configuration
Power Automate Custom Connector Security Configuration
Field Value
Parameter label API Key
Parameter name api_key
Parameter location Query

Definition Configuration:

In this version of custom connector I have created two actions in order, first “GetExchangeRatesGlobally” then,”ConvertCurrency“.

Enter the summary and operation id. Then, click on the “Import from sample” button.

Currency Exchange Rates Action in Custom Connector
Currency Exchange Rates Action in Custom Connector

Select the verb as “GET” and enter the below URL:

https://api.currencybeacon.com/v1/latest?base=USD

Click on the “Import” button.

Then, repeat the same for the “ConvertCurrency” action configuration.

Convert Currency Action Configuration in Custom Connector
Convert Currency Action Configuration in Custom Connector

This time pass the API URL as below:

https://api.currencybeacon.com/v1/convert?from=USD&to=EUR&amount=1

Note:

  • This time for both the actions I didn’t pass the default response; I didn’t touch that part, which is optional with the latest version of the API.

That’s it; configuration is done; save your connector and perform testing.

Test your Custom Connector From Connector Configuration Tool

Select your operation action from the left side panel. Click on the “+ New connection” link to create a new connection. There, you enter the API Key what you’ve got from Currency Beacon Website, you’ll get it from your dashboard as shown below:

Create connection with API Key in Power Automate custom connector
Create connection with API Key in Power Automate custom connector

Then, click on the connection refresh icon (3). Enter the below parameters:

  • from: USD (you can enter any from currency).
  • to: EUR (you can enter any from currency).
  • Amount: You can enter any amount. I have entered the amount as 100.
Test Convert Currency Action in Custom Connector
Test Convert Currency Action in Custom Connector

Click on the “Test operation” button.

Then, if you see the response status code as 200, which means your custom connector is working successfully,.

Test Convert Currency Action in Custom Connector Response Code with 200 Status
Test Convert Currency Action in Custom Connector Response Code with 200 Status

Similarly, I will test the other operation action, “GetExchangeRatesGlobally.” Here I have passed the base currency as “USD.” However, you can pass any currency as base, and then it will display all global currency rates comparing your base currency.

If you get your custom connector API response code as 200, which means it is working fine.

 

Latest Currency Information in Custom Connector Response Code with 200 Status

Latest Currency Information in Custom Connector Response Code with 200 Status Result
Latest Currency Information in Custom Connector Response Code with 200 Status Result

Test your Custom Connector From Power Automate

Create a manually trigger flow and add the below input parameters:

  • FromCurrency: Text data type
  • ToCurrency: Text data type
  • Amount: Number
Create manually trigger flow in Power Automate
Create manually trigger flow in Power Automate

Then, add a new action. Go to the “Custom” tab, and click on the custom connector you want to use in your flow. Here, I will select my working custom connector, “Currency Beacon 2.”.

By the way, here you will see all your custom connectors from your Power Platform environment.

Add custom action to Power Automate flow
Add custom action to Power Automate flow

Then, select your convert currency action.

Convert currency action in Power Automate Custom Connector
Convert currency action in Power Automate Custom Connector

In your convert currency action, pass the below parameters:

  • from: You will get it from the manually trigger a flow.
  • to: You will get it from the manually trigger a flow.
  • amount: You will get it from the manually trigger a flow.
Configure currency converter custom connector in Power Automate
Configure currency converter custom connector in Power Automate

Now, let us test this flow manually and pass the input as shown below:

Test currency converter flow manually from Power Automate
Test currency converter flow manually from Power Automate

Click on the “Run flow” button.

I can see my flow ran successfully with the below output:

Test currency converter flow manually from Power Automate - flow ran successfully
Test currency converter flow manually from Power Automate – flow ran successfully
Your flow ran successfully in Power Automate
Your flow ran successfully in Power Automate

In the output body section, we will get the below JSON:

{

  "meta": {

    "code": 200,

    "disclaimer": "Usage subject to terms: https://currencybeacon.com/terms"

  },

  "response": {

    "timestamp": 1727105878,

    "date": "2024-09-23",

    "from": "USD",

    "to": "EUR",

    "amount": 100,

    "value": 89.806072

  },

  "timestamp": 1727105878,

  "date": "2024-09-23",

  "from": "USD",

  "to": "EUR",

  "amount": 100,

  "value": 89.806072

}

By now we have learnt how to create a custom connector in Power Automate with the blank template from scratch. As we have seen, there are many other ways we can create a custom connector in Power Automate.

Create a custom connector using various other ways

In the below section, we will learn how to create a custom connector using the Import an Open API File, Import an Open API from URL, and Import a Postman collection.

Create Custom Connector With Import an Open API File Method

Download your custom connector, which you want to import in another Power Platform environment.

Download Custom Connector file in Power Automate
Download Custom Connector file in Power Automate

Import your custom connector to create a new custom connector.

From the new custom connector menu, click on the “Import an OpenAPI file” link.

Import and OpenAPI file in Power Automate
Import and OpenAPI file in Power Automate

Name your customer connector; it should not exceed 30 characters, then. Import the Swagger file that you downloaded and continue with the new connector creation process. In this method, everything will come as is; only you need to re-authenticate it.

This technique is helpful when you want to migrate your custom connector from one environment to another.

Import and OpenAPI file in Power Automate - Import swagger file
Import and OpenAPI file in Power Automate – Import swagger file

Create Custom Connector With Import an Open API from URL Method

Similarly, click on the “Import an OpenAPI URL” link from the new custom connector menu, then pass the connector name and paste the URL from the OpenAPI.

Click on the “Import” button and continue with the custom connector configuration.

Import OpenAPI from URL to Create custom connector
Import OpenAPI from URL to Create custom connector

Create Custom Connector With Import a Postman collection Method

Test API

Test your API using the Postman tool and make sure your API GET operation is successful with the 200 status code.

Test your API from Postman tool
Test your API from Postman tool

Export Postman collection

Select your postman collection. Click on the three-dot ellipses menu, then click on the “Export” link.

Export postman tool collection data
Export postman tool collection data

Click on the “Export” button as shown below:

Export collection in Postman tool
Export collection in Postman tool

Postman collection JSON file will be exported to your local drive.

Import a postman collection

Click on the “Import a postman collection” link from the new custom connector menu.

Import a postman collection in Power Automate
Import a postman collection in Power Automate

Name your custom connector and import the postman collection JSON file you exported in the above from your local drive and continue with the custom connector creation process.

Import a postman collection in Power Automate to create custom connector
Import a postman collection in Power Automate to create custom connector

Summary: Create Custom Connector in Power Automate

Thus, in this article, we have learnt about how to create a custom connector in Power Automate with the third-party API Currency Beacon using the various methods like Create Custom Connector with a blank template, Import an API file, Import an API from a URL, and Import Postman collection data. We also learnt how to create an API key on the Currency Beacon website and use that key in the Power Automate custom connector for the authentication.

Using this article and demo, easily you can convert any global currency from your application with the live data and see currency exchange rates based on any source currency.

I hope you enjoyed and liked this article and it helped you. Please consider subscribing to my site to get notifications for my future posts. 🙂

About Post Author

Do you have a better solution or question on this topic? Please leave a comment