cancel
Showing results for 
Search instead for 
Did you mean: 
ShanmugaRaja

Integrating Dynamic 365 CRM with Third party API via custom connector using Power Automate – Part1

Integrating Dynamic 365 CRM with Third party API via custom connector using Power Automate – Part1

 

This article is the first part of the integrating Dynamic 365 CRM with Third party API via custom connector using Power Automate discussion series which focuses on giving you a comprehensive description about Creating Custom Connector for Third Party API using Power Automate.


As I need a Third-Party API to access, a bit of google Fu led me to find out this free APILayer, which is really handy to request the exchange rate against a specific currency by setting the base parameter in the request.

 

Working principle of the solution is:

Our primary goal is to capture live Exchange Rate from third party API and update the currencies records in the Dynamic CE on a daily basis. I have divided this real time use case in to two parts:

1. Creating Custom Connector to retrieve live Exchange Rates using Power Automate
2. Creating recurring flow to retrieve live Exchange Rates for provided currencies and send it for an approval. The approved exchange Rates are updated in Dynamic 365 CRM on confirmation from Business users.

Power platform is enabled developer to create custom connector in five easy steps.

 

Let’s Start!!

 

Step #1: Update General Details

General tab, do the following:

  • Upload a connector icon of your choosing (optional).
  • Updated icon background color of your choice.
  • In the Description field, enter a meaningful value. This description will help others decide whether the connector might be useful to them.
  • Update Host to the address for the Currency Exchange Rate API. The connector uses the API host and the base URL to determine how to call the API.

 

ShanmugaRaja_0-1675090413016.png

 

Step #2: Specify Authentication Type:

There are several options available for authentication in custom connectors. The Currency Exchange Rate APIs use API Key authentication.

  1. On the Security tab, under Authentication type, select API Key.

 

ShanmugaRaja_1-1675090603871.png

 

2. Under API Key, update a parameter label, name and location details.

 

ShanmugaRaja_2-1675090660086.png

 

ShanmugaRaja_0-1675315274405.png

 

Step#3: Create the connector definition

Custom connectors can have one or more actions. In this article on currency exchange rate connector will only have one action.

1. On the definition tab, select New action.

 

ShanmugaRaja_0-1675091463349.png

 

2. In General section, Add a summary, description and Operation ID for this action. The summary and description will be show in Power Automate to identify the action whereas Operation ID will be used in Power Apps. Operation ID must be a text string with no space.

 

ShanmugaRaja_1-1675091533662.png

 

ShanmugaRaja_1-1675315341133.png

 

3. In Request section display inform based on the HTTP request for the action. Select Import fromsample.

 

ShanmugaRaja_0-1675091925364.png

 

4. Specify the information necessary to connect to the API. The Verb list shows a standard set of API request types (GET, POST, DELETE, PUT, PATCH, HEAD, OPTIONS). In our case, selected the GET method and specify the request URL (https://api.apilayer.com/currency_data/live?source=source&currencies=currencies) And then select Import.

 

ShanmugaRaja_1-1675092037560.png

 

When we import the sample URL its query parameters appear in the Request section. We must setup each of the parameters.

 

ShanmugaRaja_2-1675092113493.png

 

ShanmugaRaja_0-1675315428648.png

Edit the request parameters

 

ShanmugaRaja_0-1675092482224.png

 

In our case, query parameters “source” and “currencies” are required fields. So, we need to change the setting by providing a description and set Is required? field to Yes.

 

Edit Source Parameter:

 

ShanmugaRaja_1-1675092553553.png

 

Edit Currencies parameter:

 

ShanmugaRaja_2-1675092589641.png

 

5. The Response area displays information based on the HTTP response for the actions. Select Add default response.

 

ShanmugaRaja_3-1675092647108.png

 

6. Just input a sample of the response JSON into the body section and click Import.

 

ShanmugaRaja_4-1675092682058.png

 

 

Note: The JSON response can be obtained by copying and pasting our sample URL into the web browser.

7. The Validation section display any issues that are detected in API definition. The validation status will be displayed in the upper-right corner of wizard.

 

ShanmugaRaja_5-1675092783321.png

 

Step#4: Code (Preview)

This step is optional. So, I have ignored this step and going to Step 5: Test.

 

ShanmugaRaja_6-1675092843698.png

 

Step#5: Test

Before testing our custom connector, we need to Create connector. Click on Create connector button in the top. 

 

ShanmugaRaja_7-1675092960253.png

 

Now custom connector is ready to test. Click on the New connection button.

 

ShanmugaRaja_8-1675093025730.png

 

To Authenticate the custom connector, a new Tab is opened to enter the API key. This API key is obtained from the APILayer web site. After entering the API key, click the create connection button.

 

ShanmugaRaja_9-1675093086534.png

 

Return to the Test tab and click the refresh icon button in the upper-right corner of wizard.

 

ShanmugaRaja_0-1675093170617.png

 

Choose the newly create connector in the selected connection field. Then enter a value for the source and currencies fields. Finally, select Test operation button to our custom connector.

 

ShanmugaRaja_1-1675093239576.png

 

ShanmugaRaja_1-1675315520377.png

 

The connector calls the API, and we can review the response, which includes the exchange rate for provided currencies (INR, AUD, EUR).

 

ShanmugaRaja_2-1675093376545.png

 

Our custom connector is ready to fly now. In Part2, I will illustrate how to integrate this custom connector with Dynamic 365 CRM using Power Automate. Stay tuned!

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/