Article published on the 21st of March, 2024.
Contents
1. Introduction
In this article, we will go through a simple case of calling an HTTP endpoint (Power Automate flow) inside a WorkPoint Automate system process.
The case we will demonstrate is as follows:
When a new project is created in WorkPoint, we want a Power Automate flow which sends an e-mail to the project manager.
This could alternatively be achieved directly inside WorkPoint Automate, but this case is to demonstrate how to set up the connection between the endpoint, the Http endpoint library in WorkPoint 365, and the system process inside WorkPoint Automate.
To complete the stated case, we need a couple things:
- A Http endpoint configuration inside WorkPoint 365
- A Power Automate flow
- A system process in WorkPoint Automate.
This article will go through each of these steps.
2. Creating a Http configuration in WorkPoint 365
We will begin by creating a Http configuration inside the WorkPoint 365 administration to facilitate the connection between WorkPoint Automate and the Power Automate flow.
We can create Http configurations from the Http endpoint library in the WorkPoint 365 administration:
In the global settings panel in the WorkPoint 365 administration, click "Http Endpoint Library".
- To create a new Http endpoint configuration, we click the "Add" button.
- In the new Http endpoint configuration, we start by granting the configuration a title and select the "Post" endpoint action type.
- Next, we create a parameter called "to", and click the plus-icon to add it.
- Next, we create a body for the post request. Here we specify that the "To" property of the body will have the value from the "to" parameter. This is important for when we set up the WorkPoint Automate system process later, because we will be able to map the "to" parameter to a value, for example from the context of our process.
At this point, we also need a Url to the Power Automate flow we want to call using this endpoint configuration. We don't have this Url yet, so we need to go configure a Power Automate flow next to obtain this.
3. Creating a Power Automate flow
In this section, we will create a Power Automate flow to serve as the endpoint we want to call using our WorkPoint Automate system process.
First we need to navigate to the Power Automate portal at https://make.powerautomate.com/.
From here, we need to create a new instant cloud flow:
- In the left side panel, click "Create".
- In the Create menu, select "Instant cloud flow".
- Give the flow an appropriate name. Here we have titled "Send e-mail flow".
- Select the "When an HTTP request is received" trigger and click "Create".
this opens the Flow editor where we can open the "manual" step which was added automatically because we selected the "When an HTTP request is received" trigger:
Next, we need to construct a Request Body JSON Schema for the trigger to have access to the data coming into it from WorkPoint:
- The schema should reflect the data you expect to send to the trigger from WorkPoint. In the Http endpoint configuration we made in the previous section, we specified a "To" property in the Post request body, and this needs to be represented in the JSON schema here. Here we specify that the data inside the "To" property will be a string, because we will eventually be passing an e-mail address in the "To" property.
Next, we can add a "Send an email (V2)" action to the flow:
- In the "To" field of the of the Send an email (V2) action, we can insert the "To" property value coming into the trigger from WorkPoint by using the dynamic content in the flow.
- In the "Subject" and "Body" fields, we have typed some static information.
We can now save the flow, which will generate the Url we need for the Http endpoint configuration inside WorkPoint:
- Once the flow has been saved, we can copy the HTTP Post Url from the "manual" trigger. We can then go back and insert this into the "Url" field on the Http endpoint configuration in WorkPoint 365:
Now we can save the Http endpoint configuration, and it should now show in the "Http Endpoint Library" page:
Next, we can stat using this Http endpoint configuration, and by extension the Power Automate flow, inside WorkPoit Automate processes.
4. Creating a WorkPoint Automate system process
In this section, we will create a WorkPoint Automate system process and use the newly created Http endpoint configuration to call the Power Automate flow we created earlier.
Here, we have created a system process called "Send e-mail on project creation", and we have added a "When an entity is created" trigger and configured it to monitor the "Projects" module:
We can now add a "Send HTTP request" step:
- In the Options tab of the Send HTTP request step, inside the "Endpoint" field we can select our configured Http endpoint configuration from the Http Endpoint Library.
- Once the endpoint configuration has been selected, we can see the properties we have set up for it. Inside the "Send e-mail endpoint" configuration, we created a parameter called "to", whose value will be passed to the "To" property of the Power Automate flow in the "To" property. So in the "Value" field we can now pass the e-mail address we want to send an e-mail to using the Power Automate flow. Since we are sending an e-mail to the project manager of the newly created entity, we can map the Value field to "Entity.wpProjectManager.Email", like so:
We can now save and publish the system process and test it out.
Don't forget to set up a connection in the Process Builder before you attempt to run System Processes in WorkPoint Automate.
5. Executing the flow from the system process
We can now try and create a new entity inside the Projects business module.
This should trigger the system process to run, which should call the Power Automate flow:
Once the project creation has run, the flow should get triggered by the system process:
And an e-mail should be sent to the project manager of newly created project:
Comments
0 comments
Please sign in to leave a comment.