Power Automate is a powerful tool that allows you to automate various tasks, workflows, and processes. One of the key features of Power Automate is the ability to integrate with other applications and services, using connectors and APIs. One way to integrate with other services is by registering a Power Automate as a web hook. In this blog, we will discuss how to register a Power Automate as a web hook in Microsoft Dynamics CRM.
Why Use Webhooks in Power Automate?
Webhooks can be a powerful tool when used in combination with Power Automate. By registering a Power Automate flow as a webhook, you can trigger the flow from an external application or service. This can be useful in many scenarios, such as:
In today’s blog we will look how we can trigger power automate from Microsoft dynamics CRM using Web hook on create of Lead record.
Step 1: Create a Power Automate
The first step is to create a Power Automate that will act as a webhook. You can create a new flow or modify an existing one to add webhook functionality. In this example, we will create a new flow. I will create a new solution and add new flow in it.
To create a new flow, log in to Power Automate and click on the “Create” button in the top right corner. Select “Instant – from blank” as the flow type.
Step 2: Add a trigger
The next step is to add a trigger to your flow. A trigger is an event that will start your flow. We will use HTTP request trigger .
Step 3: Add an action
Once you have added a trigger, you need to add an action to your flow. An action is a task that your flow will perform in response to the trigger. For example, you can send an email using outlook connector , here to demonstrate i am using outlook send email connector.
To add an action, click on the “New Step” button and select “Add an action”. Select the outlook send email option from the list of available actions.
Note – To execute the power automate in a synchronous manner you have to add a response to http trigger . In case we are not adding response action as plugin pipeline execution will not wait for any response from the power automate and proceed .
After saving the power automate an HTTP URL will be generated .Copy the URL and paste it in a notepad.
We will split the based on each parameter available in query string , as shown in above screenshot.
Step 4: Add a webhook in Plugin registration tool
The next step is to add a webhook action to your plugin. We will register a webhook in plugin when a lead is created in dynamics CRM. Click on Register > Register a web hook and fill in the details from the URL as shown below.
You can replace %2f by forward slash ‘/’ , or simple decode the value online .
Step 5: Configure the webhook action
Once you have added the webhook action, you need to configure it. You need to provide the URL of the external service that you want to notify, along with any required headers and parameters.
To configure the webhook action, click on the “HTTP – HTTP” action and enter the URL of the external service in the “Uri” field. Enter any required headers and parameters in the appropriate fields.
Next step is to register a step for the web hook . For demonstration I am registering on create of lead .
Step 6: Save and test your flow
Once you have configured the web hook action, you need to save your flow and test it.
Lets create a lead and test .
Flow got successfully triggered .
This is one of the way to trigger power automate from CRM .
Thanks for reading hope this helps !
Original Post https://msdynamicscrm137374033.wordpress.com/2023/04/27/use-power-automate-as-a-web-hook-in-microsoft-dynamics-crm/