HttpTrigger Archives - Microsoft Power Platform Blog Innovate with Business Apps Wed, 04 Oct 2023 16:00:00 +0000 en-US hourly 1 Deeper control over HTTP invocation of flows http://approjects.co.za/?big=en-us/power-platform/blog/power-automate/deeper-control-over-http-invocation-of-flows/ Wed, 04 Oct 2023 16:00:00 +0000 HTTP request trigger is a frequently used functionality that helps customers integrate Power Automate with other systems. This allows a flow to be started based on an HTTP call. Today, we are introducing OAuth support for HTTP request triggers for deeper control on what applications and users can invoke such automations.

The post Deeper control over HTTP invocation of flows appeared first on Microsoft Power Platform Blog.

]]>
Customers frequently use “When a HTTP request is received” trigger as a key piece of the extensibility story for their own applications and services. Using this trigger, a unique URL is generated on flow save and customers can trigger Power Automate workflows by sending an HTTP request to this URL.

Today, we are excited to announce a new capability for this trigger. Customers can now add OAuth authentication to such HTTP request triggered workflows, to add an additional layer of control to this workflow. With a single parameter within the trigger, makers can restrict only users within their tenant can trigger this workflow by sending an HTTP request to the URL. This will be the default option for this trigger moving forward, to ensure customers create secured endpoints by default.

 

Customers can further lock down who can trigger this workflow to specific users within the tenant. This list could contain specific user ids or service principal object ids, on whose context the workflow might be triggered.

 

 

 

Once either of these parameters are added to this trigger, then only those requests that contain the specific claims (tenant id, user id or object id) in the http requests will be allowed to trigger the flow.

You can learn more about this capability here. It is also recommended to check out the Microsoft Authentication Library (MSAL) to understand how you add the right claims in your HTTP request, depending on the language and framework you are using within your application or service.

Please feel free to provide your questions and feedback in the Power Automate community.

Happy Automating!

The post Deeper control over HTTP invocation of flows appeared first on Microsoft Power Platform Blog.

]]>
Calling Microsoft Flow from your application http://approjects.co.za/?big=en-us/power-platform/blog/power-automate/call-flow-restapi/ Wed, 02 Nov 2016 08:03:48 +0000 This tutorial will teach you how to trigger Microsoft Flow from an application.

The post Calling Microsoft Flow from your application appeared first on Microsoft Power Platform Blog.

]]>
Microsoft Flow allows you to turn complex repetitive tasks into automated multistep flows. In many cases, you want your flow to be triggered by an event, such as a document update. In others, you want to let the end user initiate a flow. In this case, Microsoft Flow will serve as an integration glue between your application and large number of other services. For example, you may want the user to click on a button and send an email to her customers. In this article, we will demonstrate five simple steps that will help you build flow and trigger it using simple REST API call. For the sake of simplicity, we are using the Postman Chrome App to send REST API calls.

Step 1:

Before we start implementation, let’s think about the format of the call. In this example, triggering an email from application, we want to pass the following information from the client to the flow: email address, email subject and the text of the email. Our request body will look like this:
 

{
    “emailaddress”:”<your address goes here>”,
    “emailSubject”: “Hello”,
    “emailBody”: “Hello from Microsoft Flow”
}

We will also need a JSON schema defining the format of the request. To simplify schema creation, you can use one of many schema generators available on the web. We used jsonschema.net.
 
Copy/paste the request body and click on Generate Schema. The tool will generate a schema like this one:

 
{
  "$schema": "http:/https://www.microsoft.com/json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "emailadress": {
      "type": "string"
    },
    "emailSubject": {
      "type": "string"
    },
    "emailBody": {
      "type": "string"
    }
  },
  "required": [
    "emailadress",
    "emailSubject",
    "emailBody"
  ]
}

 

Step 2:

We start in https://flow.microsoft.com/en-us/ by creating a new Flow (click on My Flows and Create from blank). When prompted to search for triggers, choose Request.

 

 

There are two boxes in this form: one for the URL that your application will call, and one for the JSON Schema defining format of the request. Start with the JSON Schema field, and paste the schema generated in Step 1 into it.

 

Step3:

Add an action by clicking on the “+ New Step” and choosing “Office 365 – send an email.”
When you click on any field in the form, you can see JSON parameters (from the schema) that can be added into the fields.

 

Click again on the “+New step” and choose the “Response” action. Here you have an option to either specify the JSON body of the response, such as {“status”:”success”}, or use the Body of the original request by clicking on the “Body” property.

 

 

Please note that if one of the previous steps of the flow fails, this action won’t execute and your application will receive an error response:

{
  "error": {
    "code": "NoResponse",
    "message": "The server did not receive a response from an upstream server. Request tracking id '08587237214980038925577763844'."
  }
}

Step 4:

Give your flow a name and click on the “Create Flow” button. Once your flow is created you can click on the Request bar and see that a URL has been generated by the system:

 

 

Please note that generated URL contains an access key. We recommend that you avoid sharing your URL with anyone else.
 

Step 5:

 
Copy this URL and JSON body into Postman:

 

 

Don’t forget to add a Content-type header = applicationhttps://www.microsoft.com/json.

Send the request, wait a moment, and then check your inbox for the email. Voila!

 

 

In Postman, you will also see a response:


{
    "emailadress":"myemail@miosoft.com",
    "emailSubject": "Hello",
    "emailBody": "Hello from Microsoft Flow"
}

Postman can also generate a code snippet for you in programming language of your choice. Click on the Code button and choose programming language.

 

To summarize:

Decide on the call format, create a flow with an HTTP Trigger, add an email action and Response Action, and issue a Post request.
Now you can use Flow to create powerful custom HTTP triggers that your application can invoke at any time. Please try it out and share with us your integration stories.

The post Calling Microsoft Flow from your application appeared first on Microsoft Power Platform Blog.

]]>