Latest Posts

How to call power automate flow from javascript


You can call a Power Automate flow from JavaScript by using an HTTP request (typically via fetch() or XMLHttpRequest) — but this only works if your Power Automate flow has a HTTP trigger. 

Create a Flow with HTTP Request Trigger 

1.        In Power Automate, click + New flow > Instant cloud flow 

2.        Choose "When an HTTP request is received" as the trigger 
 

How to call power automate flow from javascript

 

3.        Add the actions you want (e.g., update a SharePoint list, send an email, etc.) 

4.        Save the flow 

After saving, Power Automate will generate a URL endpoint (HTTP POST URL from above screenshot).  

Copy the HTTP POST URL 

You’ll find it in the trigger once the flow is saved. It looks like: 

https://prod-00.westus.logic.azure.com:443/workflows/xxxx/triggers/manual/paths/invoke?api-version=2016-10-01&sp=xxxx&sig=xxxxx 

 

Call the Flow from JavaScript 

·          We’ll create an html page and put JavaScript in it to trigger the flow. 

·          Here’s the entire html including JavaScript:  

 

<html> 

<body>   

<h2>Call PowerAutomate from JavaScript</h2>   

<button onclick="myFunction()">Try it</button>    

<script> 

function myFunction() { 

const url = "<Your HTTP POST trigger URL>";    

const data = {    

  name: "Rahul Dravid",    

  email: "[email protected]   

};   

fetch(url, {    

  method: "POST",    

  headers: {    

    "Content-Type": "application/json"    

  },    

  body: JSON.stringify(data)    

})    

.then(response => response.json())    

.then(result => {    

  console.log("Flow response:", result);  

  })    

.catch(error => {    

  console.error("Error calling flow:", error);    

});     

} 

</script>    

</body> 

</html>  

 

RUN 

o   Click on the button and the button will POST the URL which will eventually trigger the flow. 

o   Here, we have passed 2 arguments, Name and Email. You can utilise them in the flow in the subsequent actions.  

o   triggerBody()?['name'] 

o   triggerBody()?['email'] 

 

How to call power automate flow from javascript

 


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2025 Code SharePoint