Run Power Automate flow from the Postman using API

In this post, we will run the Power Automate flow using the API from Postman. First, we will create a simple flow to send an email OTP. We will get the inputs by calling the API.

Following are the inputs we need to send the email –

  1. Email Address
  2. Email Subject
  3. Email Body

This demo is part of an E-commerce bot for the email authentication feature.

Prerequisites

  1. Postman
  2. Microsoft Flow Account

Postman link is available on the Downloads page.

Microsoft

Video

Create Power Automate Flow

Login to flow.microsoft.com. Create an instant cloud flow. I am naming it SendOTPNaamiChocos. Skip the trigger.

Search for the trigger category Request.

Choose the trigger When an HTTP request is received.

Microsoft

Below is the request body we will use to call an API. Instead of OTP, you can mention the emailBody if you are generating it from the Postman or code. But here, I will create the email template in the flow and pass the OTP to it.

{
    "emailAddress":"info@jd-bots.com",
    "emailSubject": "[NaamiChocos] Email Verification Code",
    "userName": "JD Bots",
    "OTP": "458715"
}

This is just a sample. With this sample, we will create the JSON schema. In the flow, click on Use sample payload to generate schema.

Copy the above JSON to the sample payload and click on Done.

This generated a JSON schema out of my sample.

{
    "type": "object",
    "properties": {
        "emailAddress": {
            "type": "string"
        },
        "emailSubject": {
            "type": "string"
        },
        "userName": {
            "type": "string"
        },
        "OTP": {
            "type": "string"
        }
    }
}

Add a new step – Send an Email (V2). I am using the Outlook connector. You can also use the Office 365 connector which is recommended. Since I don’t have the Office 365 email, I will go with Outlook.

When you select the Outlook Send Email action, you will be prompted to sign in and give permissions. Use the dynamic content to add the variables.

Add a new step Response. This is useful to send a successful response. Remember, if any of the steps before the Response fails, this step will throw an error.

Your final flow looks like this.

When you save your flow, the HTTP POST URL will be generated by the first step.

This request URL contains the access key. Make sure you don’t share it with anyone else.

Make an API call from Postman

Copy the above request URL and paste it in the Postman along with the request body.

This is a POST request. Add the header Content-type with the value application/json. Click on Send.

Output from Postman:

Output from Power Automate:

You can open up the individual steps to see their output.

Output from Email:

Thank you All!!! Hope you find this useful.


Microsoft

Leave a Reply

Up ↑

%d