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.
Key Concepts of a Custom Connector:
- 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.
- 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.
- Authentication Support: Custom connectors can handle different authentication types like OAuth 2.0, Basic Authentication, and API Keys, ensuring secure connections to external services.
- Custom Actions & Triggers: You can define custom actions (tasks your connector can perform) and triggers (events that initiate workflows) to suit specific business needs.
- 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:
- 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.
- Historical Exchange Rates:
- The API also provides historical data, allowing users to track and analyze currency trends over specific time periods.
- 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.
- 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.
- Currency Conversion:
- With Currency Scoop, you can perform quick and accurate currency conversions, helping users or businesses to calculate exchange rates dynamically.
- 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.
- 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.
Then, copy the API key, you will get it from your account dashboard.
Review the documentation of Currency Beacon API
To review the Currency Beacon API documentation, go this page – Global Currency Data 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:
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.
There are many ways to create a new custom connector as shown below:
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:
Name your customer connector. I have named as “Currency Beacon”.
Click on the “Continue” button.
Upload the connector icon image which is an optional step.
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
I will go with the “API Key” authentication type. Refer to the below screen for what and how to configure the security.
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.
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
Click on the “Import” button.
Once we import, the screen looks like below:
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.
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).
Similarly, configure the “To” currency parameter.
Then, finally, configure the base currency amount parameter.
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.
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.
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.
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.
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.
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.
Enter the API key you got from the Currency Beacon website.
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:
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.
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.
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:
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.
Click on the “Test operation” button.
Then, if you see the response status code as 200, which means your custom connector is working successfully,.
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.
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
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.
Then, select your convert currency action.
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.
Now, let us test this flow manually and pass the input as shown below:
Click on the “Run flow” button.
I can see my flow ran successfully with the below output:
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
Create Custom Connector With Import an Open API File Method
Download your custom connector, which you want to import in another Power Platform environment.
Import your custom connector to create a new custom connector.
From the new custom connector menu, click on the “Import an OpenAPI file” link.
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.
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.
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.
Export Postman collection
Select your postman collection. Click on the three-dot ellipses menu, then click on the “Export” link.
Click on the “Export” button as shown below:
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.
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.
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. 🙂