9 Mar 2022

Use webhooks in Power Automate

There are two ways to handle callbacks from a webhook in Power Automate:
1) Create a custom connector that implements the trigger that would enable you to subscribe to a given webhook
You would do this if you wanted to make it easier for others to register to a webhook without having to know the endpoints to use, make it easier to select the folder to monitor (in case of e.g. dm.version.added event), etc

2) Use an existing trigger like "When a HTTP request is received"

In this blog post we'll cover the latter.

Let's just create a new Flow with the above mentioned trigger:

Create new flow

Once we add an action to it (like sending an email) then we can save the flow and then the trigger will generate a URL that we can use as callback URL when registering our webhook:

Save flow to generate callback URL

In order to test the dm.version.added event I also referred to above, I would need the folder id that I want to monitor for that event. In case of BIM 360 Docs I can simply navigate to that folder in the web interface and then check the URL:

Find out the folder idNow that we have both the folder id and the callback URL to use, we can register our webhook to test things. For me the easiest way to do that is to use the Visual Studio Code extension, but you could use Postman, Insomnia, or any other tool, really:

Create webhook

Now we can test the flow:

Test the flowAs the green ticks indicate, we managed to catch the callbacks when a new file got uploaded and send an email about it.

We can also check what exact message the trigger received and use it to make it easier for the other actions inside the flow to extract data from future messages:

Update schema in triggerNow we can use e.g. fileName directly inside the action that send an email:

Use file name inside the send email actionAfter uploading a new file to the same BIM 360 Docs folder I did get an email with the correct file name:

Email received with correct file name   

Related Article