We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
TheOC
16 - Nebula
16 - Nebula

image001.gif

How cool is that?!

 

A late-night thought that spiraled

 

The inspiration for this project came from trying to use the Alteryx Server one evening, just to produce a simple output. Through this process, the question popped up:

 

“There must be an extra layer of automation. How can I streamline this process so I can easily run workflows from my mobile?”

 

Spoiler: It’s easy to set up, and by the end of this post, you will be able to, too!

Why is this cooler than a scheduled job?

 

A good question.

  • Run-from-anywhere – In the airport, supermarket queue, sofa, just ask Siri to run your workflow and get your answer!
  • Leverage IOS Automations – If you’re not already using IOS automations, I’d massively recommend it. You can set tasks to run based on a huge array of conditions. What if we have a workflow run when you park at the office? Connect to your home network? Or when the weather is bad?
  • Office Bragging rights – Steve from finance is still running his workflows manually. Let’s all laugh at Steve.
  • Just the start – Why stop here? Let’s get Cortana (Is that still a thing?), Google voice assistant, and Alexa involved, make it a party!

 

How does this actually work then?

 

I’ve got a very simple example workflow:

 

image002.png

 

All I’m really doing is running a formula and outputting my message for my workflow within a message tool. It is this message I want to capture from the workflow running on the Alteryx Server – but I could absolutely extend this to output files or to send emails, etc. Anyway, I’ve uploaded that workflow to my Alteryx Server and tested that it works:

 

TheOC_2-1756846361444.png

 

Great, now the rest of the work is going to be on my phone within the Shortcuts app.

 

What on Earth are iOS Shortcuts?

 

I see Shortcuts as Apple’s LEGO set for automation. It’s on most iPhone and iPad devices, and it allows you to drag and drop actions into flowcharts, not too dissimilar to Alteryx. This can allow you to do things like:

  • Open specific apps
  • Hit web APIs (remember this point for later)
  • Read today’s weather, news, and stocks
  • Send texts (I use it to spam @mceleavey)

 

Once these are set up, they can be triggered via Siri, run on a schedule, run when you arrive somewhere/tap an NFC tag, or even when you end a workout. There’s no coding required, just some logic/flow building.

 

Building the IOS Shortcut

 

My IOS Shortcut is roughly going to do:

  1. Hit the Alteryx Server API to request an authentication token, and store this value for use in subsequent requests
  2. Run a particular workflow by again leveraging the Alteryx Server API, using the workflow ID within the /v3/workflows endpoint and the access token previously generated.
  3. Wait 5-10 seconds, then get the results by calling the v1/jobs endpoint (I realize this can be improved by creating a loop to check when the workflow finishes – we’ll keep it basic for now)
  4. Extract the results of the workflow, and loop through each message in the workflow to find the message that contains the information we need.
  5. End the script and display the output.

 

To make that as easy as possible to follow, I’ve tried to highlight those sections in the Shortcut I’ve built. On the left is unedited, on the right I’ve overlapped highlights over the sections to help break down the logic:

 

image004.png

   

Once that’s built and tested, it’s a simple case of adding it to Siri as a shortcut (Settings > Accessibility > Vocal Shortcut)

 

image005.jpg

 

And we can now run an Alteryx workflow by asking Siri and receive a visible response:

 

image007.png

 

Give it a whirl!

 

Honesty, this doesn’t take that long to set up – and I’m super excited about the potential use-cases of this. If you do happen to give this a go, please do share a recording or a description of what you use it for!


See you in Orlando!
✈️

 

I’ve attached an expanded shortcut – with my credentials and details removed. If you do have an iPhone/iPad, simply download my shortcut, make the relevant changes (anywhere I’ve labelled with square brackets), and hit run!

Comments