Have you ever wanted to:
- Automatically trigger Alteryx workflows based on events with Power Automate?
- Run an Alteryx workflow by clicking a button in Power BI?
- See a list of Alteryx workflows in a Power App, and be able to start them by clicking a button?
All of the above, and more, has been made possible by Alteryx Server version 2021.4, which now close to a year after its release, is starting to see widespread adoption.
Alteryx Server version 2021.4 brought OAuth2 authentication to the Alteryx Server API, which is huge, as it finally allows easier access to call Alteryx Server API endpoints, without the use of Python/PowerShell or similar code based solutions.
This for instance allows us to use HTTP actions in Power Automate to call the API, and this in turn allows to access the API from the rest of the Power Platform.
In this article, I will describe in detail how to:
- Find the necessary credentials and endpoints to get started with OAuth2 on your Alteryx Server.
- Set up a manually triggered Power Automate flow to run an Alteryx Server workflow.
- Set up an automatically triggered Power Automate flow to display a list of available Alteryx Server workflows in a Power App.
- Dynamically change which flow to run with the first Automate flow, by selecting the Alteryx Workflow from the list in Power Apps.
Step 1: Getting your credentials and endpoints
In order to call the Alteryx Server API with HTTP actions in Power Automate, you will need to gather the following information:
- Your Alteryx Server base URL
- Your Client ID and Client Secret for authenticating with OAuth2
- The endpoints of the API you wish to access
- Workflow ID of a workflow you wish to run.
Base URL:
If you login to your Alteryx Server Gallery, you should see an address like ‘http://{ServerHostname}/gallery/’.
Similarly, your base API URL, which is the one you need to call the API, will be ‘http://{ServerHostname}/webapi/’, unless your Server Admin has changed any of these defaults values, in which case you should ask your Admin for the URL.
Take a minute to check out Alteryx’ own documentation on the Alteryx Server API for further details: https://help.alteryx.com/20221/server/alteryx-server-api-v3
The Data School also has an excellent guide on connecting to the Alteryx Server API with OAuth2: https://www.thedataschool.com.au/shiva-ravi/connecting-to-api-using-oauth-2-from-alteryx/
Client ID and Client Secret:
From the Alteryx Server Gallery, navigate to your User Profile in the top right corner, and scroll down until you see your Client ID and Client Secret (If you do not see Client ID and Secret in your profile, ask your Admin to enable API access for your Gallery user, and they should appear).
Write those keys down, as we will need these multiple times throughout the exercise.
Endpoints:
For this exercise, we will use the following endpoints:
- To authenticate to our API with our keys: ‘/webapi/oauth2/token’
- To extract a list of workflows from the Server: ‘/webapi/v1/workflows/subscription?limit=11341484’
- To run a workflow on the server: ‘/webapi/v1/workflows/{workflowID}/jobs’
There is much more to the Alteryx Server API than the above endpoints, and I’ll suggest checking out the general Swagger API Documentation for your Alteryx Server.
To do so, from the Question Mark (?) menu in the top right of your Alteryx Gallery, select ‘API Documentation’ to be taken to the documentation page for your Alteryx Gallery API.
Alternatively, access the documentation directly with the URL: http://{ServerHostname}/webapi/swagger.
Workflow ID:
From your Alteryx Server Gallery, select a workflow that you wish to run, and copy the ID from the URL of the workflow, and save it for future reference.
Step 2: Set up a manually triggered Power Automate flow to run an Alteryx Server workflow.
Go to make.powerautomate.com, and create a new Instant Cloud Flow, using the PowerApps trigger (or simply “Manually trigger a flow”, if Power Apps is not up your alley).
Set up your trigger like below, to make our flow ready for becoming dynamic at a later stage in the guide.
First, we want to use our Keys to authenticate against our API, and receive a Bearer Token that we can use to call the different endpoints. To do this, HTTP action, with the following configuration:
- Method: POST
- URI: http://{ServerHostname}/webapi/oauth2/token
- Headers: Content-Type = application/x-www-form-urlencoded
- Body: grant_type=client_credentials&client_id={YourClientID}&client_secret={YourClientSecret}
Save and Test your Flow, and check in the Flow Run History that your call successfully authenticates, returning Status Code 200 and a JSON Body including a Bearer Token.
To parse out the Bearer Token for use in the flow, insert a Parse JSON action as the next step in your flow. As ‘Content’ in the action, choose to insert dynamic content, and find the ‘Body’ output from your HTTP action. For the ‘Schema’ field, to make things easy, copy the code of the Body from the previous Run History screen and paste into the “Generate from Sample” box in the Parse JSON action.
Next, Add an ‘Initialize Variable’ action, and create a String variable called “BearerToken”, providing the dynamic content ‘Access_Token’ from your Parse JSON action in the Value field of the action.
Finally, make another HTTP action, with the following configuration:
- Method: POST
- URI: http://{ServerHostname}/webapi/v1/workflows/{WorkflowID}/jobs
Note, that you can replace {WorkflowID} with the ID of the workflow you wish to run, if you want the flow to always run the same workflow, or you can put the dynamic content of the Variable initiated by our PowerApps flow trigger, as the ID for dynamic execution.
- Headers:
- Content-Type: application/x-www-form-urlencoded
- Authorization: Bearer {BearerToken}
Replace {BearerToken} with the dynamic content variable ‘BearerToken’ created in your Initialize Variable action.
Save and Test your workflow, and check the Workflow Results of your Alteryx Server Gallery, to see if your workflow ran correctly. If it did: CONGRATULATIONS! You just started an Alteryx Server workflow from Power Automate.
Step 3: Set up an automatically triggered Power Automate flow to display a list of available Alteryx Server workflows in a Power App.
If you want to make the Flow above dynamic, and be able to choose what to run, from a list of available workflows, we can create another Power Automate flow to return said list of available Alteryx Server workflows.
Step 3.1: Create the Power Automate flow to return a list of workflows
Once again, go to make.powerautomate.com, and create a new Instant Cloud Flow, using the PowerApps trigger. This time, no need to create any dynamic inputs:
Next, we setup an identical HTTP action to the one in the previous flow, to return a Bearer Token:
And again, use the Parse JSON and Initialize variable actions to parse out the Bearer token, and store it in a variable.
Then create another HTTP action, this time a GET request, calling the final endpoint you noted down in the beginning, using a slightly different set of Headers for the call:
- Method: GET
- URI: http://{ServerHostname}/webapi/v1/workflows/subscription?limit=11341484
Note, that you can replace {WorkflowID} with the ID of the workflow you wish to run, if you want the flow to always run the same workflow, or you can put the dynamic content of the Variable initiated by our PowerApps flow trigger, as the ID for dynamic execution.
- Headers:
- Accept: application/json
- Authorization: Bearer {BearerToken}
Replace {BearerToken} with the dynamic content variable ‘BearerToken’ created in your Initialize Variable action.
Save and Test your Flow, and check in the Flow Run History that your call successfully authenticates, returning Status Code 200 and a JSON Body that lists the Workflows on your Alteryx Server including a bunch of metadata.
To parse out the result once again, copy the Body Output from the Run History Screen, and insert into the “Generate from Sample” box in a new Parse JSON action, which uses the dynamic content ‘Body’ from your HTTP 2 action:
The number of columns is quite overwhelming. Hence, to select only the columns needed for this exercise, insert a ‘Select’ action, mapping the dynamic content outputs ‘id’ and ‘fileName’ to two new variables: WorkflowID and WorkflowName, as seen below:
Use an ‘Initialize Variable’ to convert the dynamic content ‘Output’ from your Select action, into a variable. In this case, i named my variable ‘WorkflowObject’.
Finally, add a ‘Respond to a Power App’ action as the final step, and add your newly created ‘WorkflowObject’ to an Output. I called mine ‘Workflow List’.
Step 3.2: Set up a basic Power App to automatically call the Power Automate flow, and display the results in a gallery.
Go to make.powerapps.com, and create a new, blank Canvas Power App.
In the left hand side of the interface, select Power Automate, click ‘Add Flow’, and select both of your newly created Power Automate flows. If you do not see your flows, you might have forgotten to choose ‘PowerApps’ as the manual trigger, as only those flows will show up here.
In the App’s ‘OnStart’ property, write a line of code which runs the Power Automate flow we just created, and saves the output into a variable. This will now happen everytime we open this Power App. The code could look like the below example:
To run this code, you can either save and reload your app, or you can create a temporary button to execute the same code.
Next, insert a Gallery Control on your Screen. It is on the Items property of the gallery, that we will parse out the list of Workflows returned by the Automate flow. To do so, we need to use the ParseJSON() function on the WorkflowList output, and loop through the results to create a gallery of the results. The code could look like the below example:
Now, insert two Text Label Controls in your Gallery, to display the WorkflowName and Workflow ID of each item.
If everything went well, you should now have a Power App, which whenever it is loaded, populates a Gallery with a list of all the Alteryx Server workflows returned by your Power Automate flow, including information about the name and ID of the flows!
Step 4: Dynamically change which flow to run with the first Automate flow, by selecting the Alteryx Workflow from the list in Power Apps.
All there is left to do, is for us to setup the Power App to dynamically pass the ID of a workflow of our choice to our first Power Automate flow, to trigger the run of the selected Alteryx Server workflow.
To do so, Create a Button Control inside your Gallery, and configure its OnSelect property to trigger our first Power Automate flow (the one we did not use in the OnStart formula in the Power App), and this time, pass ‘ThisItem.WorkflowID’ as a parameter inside the function, as shown below:
Now, go to make.powerautomate.com, and modify the last HTTP Action in that Power Automate flow, to use the dynamic content that is being passed to the Flow from Power Apps when you run the flow, if you didn’t do it back then. In my case, I named this ‘IDFromApps’ back in the very first image of this article:
Save your Workflow, and try out your solution by clicking the buttons you configured in the Power App. Verify the results by checking the Workflow Results in your Alteryx Server Gallery:
Congratulations! You have now created what is essentially a small Alteryx Server on top of the Alteryx Server. It might sound a bit backwards, but the above applications of the Alteryx Server API in the Power Platform opens up a host of possibilities.
- The Power Automate flows could be triggered by a button inside your Power BI reports.
- The Power App could be part of a bigger Power Apps solution, or embedded into a Power BI report, to enable users to run Alteryx workflows from within the Power Platform tools.
- The Power Automate flows could have Automatic Triggers, instead of Manual triggers, in order to run Alteryx Server workflows on any of the usual Power Automate conditions like:
- When a row of data is created or modified in a table
- When a calendar event is created
- When a form is submitted
- When a new email arrives
Limitations and Considerations
Some limitations and considerations apply to the methods above:
- Currently, the OAuth2 authentication on Alteryx Servers can only be called from HTTP actions, and not from Custom Connectors, as Custom Connectors do not support OAuth2 authentication with the grant type ‘Client Credentials’, which is the case with Alteryx Server.
- Remember that you are essentially bypassing any user restrictions on the Alteryx Server with the API calls made by the Automate Flows created in this article. Consider adding extra filters to e.g. the API call returning a list of workflows, if you intend to share the Flow and its implementation with other users who don’t have the same Alteryx Server rights.

Leave a comment