Integrating Mendix with Power Automate – Send Input from Mendix UI and Receive Response Back

0
Hi everyone, I am working on a Mendix application where I need to integrate Mendix with Power Automate. Requirement overview: End users enter input data on a Mendix page (e.g., name, website, keyword, address, etc.) On button click, this data should be sent from Mendix to a Power Automate flow Power Automate will process the data (API call / web screening / RPA / SAP / logic) The processed response should be sent back to Mendix Mendix should display the returned data on the UI and store it in the domain model What I want to understand: What is the recommended integration approach between Mendix and Power Automate? Consumed REST service from Mendix? Power Automate HTTP trigger? How should the request and response JSON be structured? How can I pass input from Mendix screens (microflow) to Power Automate? How can Power Automate send data back to Mendix (synchronous vs asynchronous)? Best practices for error handling and security (authentication, headers, etc.) If anyone has implemented a similar Mendix ↔ Power Automate integration or has reference examples, your guidance would be very helpful. Thanks in advance!
asked
1 answers
-1

Hello Yogeshwar 

 

I will try to briefly answer the questions you enumerated

 

1. What is the recommended integration approach?

The recommended approach is a REST-based architecture using:

  • Mendix: A Consumed REST Service.

  • Power Automate: An HTTP Request Trigger (inside the "Request" connector).

     

This is preferred over other methods because it is platform-independent, supports real-time data exchange, and allows Mendix to maintain control over the execution flow.

 

2. How should the request and response JSON be structured?

The structure depends on your business logic, but it should be kept flat where possible to simplify mapping.

  • Request (Mendix → PA): ```json { "UserEmail": "string", "InputData": { "Website": "string", "Keyword": "string", "Address": "string" } }

  • Response (PA → Mendix):

    JSON

     

    {
      "Status": "string",
      "ProcessedResult": "string",
      "ErrorCode": "integer"
    }
    

Tip: Use a JSON Structure document in Mendix to generate the necessary Import and Export Mappings automatically.

 

3. How can I pass input from Mendix screens to Power Automate?

Input is passed via a Microflow triggered by a button on your page:

  1. Collect Data: The Microflow receives the entity containing the screen inputs.

  2. Map to JSON: Use an Export Mapping activity to convert that entity into a JSON string.

     

  3. Call REST: Use the Call REST Service activity. Set the HTTP Method to POST and pass the JSON string in the Request Body.

4. How can Power Automate send data back to Mendix?

This depends on the processing time:

  • Synchronous (Recommended for < 60s): Use the Response action in Power Automate. Mendix waits for the connection to complete and receives the data directly in the "Response" section of the Call REST activity.

  • Asynchronous (Recommended for long-running RPA/Logic): Power Automate sends an immediate "202 Accepted" response to Mendix. Once the processing is finished (minutes later), Power Automate uses an HTTP POST action to call a Published REST API in Mendix to update the record.

5. Best practices for error handling and security

Security

  • Authentication: Power Automate uses a Shared Access Signature (SAS) in the URL (the sig parameter). Treat this URL like a password.

     

  • Custom Headers: For added security, add a X-API-Key header in the Mendix Call REST activity. In Power Automate, use a Condition action immediately after the trigger to check if the header matches your secret key.

Error Handling

  • In Mendix: Use Custom Error Handling on the Call REST activity. If the status code is not 200, log the error and show a "Validation Feedback" or "Show Message" activity to the user.

  • In Power Automate: Use the "Configure Run After" setting. Create a "Scope" for your main logic and another "Scope" for error handling that only runs if the first scope fails or times out. This ensures Mendix always receives a valid JSON response even if the internal flow fails.

answered