Power Community

Power Community

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!

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

On-premises data gateway September 2023 release

Welcome to September! Here is the September 2023 on-premises data gateway release (version 3000.190.17). This update brings the on-premises...

More Articles Like This

- Advertisement -spot_img