cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jronash
Solution Supplier
Solution Supplier

HTTP OPTIONS call to Power Automate

Hello all,

 

I've used the 'When a HTTP request is received' trigger fairly extensively, but I'm working with a new scenario and I've been having trouble getting it to work.

 

I want to use Automate to subscribe to a Webhook provided by some third-party software that my company uses.  In order to subscribe to their webhook, there's a handshake process that I need to go through.  As part of the handshake, an OPTIONS HTTP call will be made to my Flow, and the Flow will need to return an appropriate response.

 

I'm trying to test this out before I actually subscribe to the Webhook, but I'm having trouble calling the Flow using the OPTIONS method.  I've tried a couple of different ways, but I seem to always receive an error like this:

"The HTTP method for this request is not valid: expected 'POST' and actual 'OPTIONS'."

 

Does the HTTP trigger accept OPTIONS calls?  Or is the problem something to do with the way that I'm making the call?

1 ACCEPTED SOLUTION

Accepted Solutions
Jronash
Solution Supplier
Solution Supplier

So I found a solution to this after all, and it's not even that difficult.

 

On the 'When a HTTP request is received' trigger, go down to advanced options and go to the Method field.  OPTIONS is not included in the list, but you can enter a custom value and write OPTIONS in yourself.  Then this flow will be able to catch and respond to OPTIONS calls.

 

In the case of subscribing to a webhook, you probably only need to receive an OPTIONS call for the initial handshake setup.  After that, you will be receiving POST requests.  So in that case, you would set up the flow with the OPTIONS trigger and build whatever flow you needed so that you could respond appropriately to the call.  Once you've responded to the call and your webhook subscription is active, go back to the  trigger and change the method to POST.  Then re-build your flow so that it responds to the webhook calls.

View solution in original post

2 REPLIES 2
Jronash
Solution Supplier
Solution Supplier

I believe I've confirmed that Automate responds to OPTIONS calls at lower level, without triggering the flow itself.

 

When I was trying to send the HTTP OPTIONS call before, I had some syntax errors.  Once I fixed them, I was successfully getting a response back from my flow, but when I went to the run history, there was nothing there.  The response was being sent without actually triggering the flow.  So if you need to send a custom response to an HTTP OPTIONS call, Automate isn't going to work for you.

Jronash
Solution Supplier
Solution Supplier

So I found a solution to this after all, and it's not even that difficult.

 

On the 'When a HTTP request is received' trigger, go down to advanced options and go to the Method field.  OPTIONS is not included in the list, but you can enter a custom value and write OPTIONS in yourself.  Then this flow will be able to catch and respond to OPTIONS calls.

 

In the case of subscribing to a webhook, you probably only need to receive an OPTIONS call for the initial handshake setup.  After that, you will be receiving POST requests.  So in that case, you would set up the flow with the OPTIONS trigger and build whatever flow you needed so that you could respond appropriately to the call.  Once you've responded to the call and your webhook subscription is active, go back to the  trigger and change the method to POST.  Then re-build your flow so that it responds to the webhook calls.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,572)