This article provides the steps and resources to support the task of calling a flow from an iOS shortcut.
Apple created the iOS Shortcuts feature, allowing users to create scripting widgets. This article describes the creation of a shortcut that calls a Fuuz flow.
This shortcut must be run on a webpage because it runs JavaScript.
In testing, the Get Contents from webpage script never works correctly with a Post command. This prevents scripting from working anywhere else.
Create a shortcut.
Retrieve the Safari web pages input from the Share Sheet.
Run the JavaScript on Shortcut Input.
(Optional) Enable the Show alert option.
The code uses basic JavaScript to make a post back to Fuuz.
var xhr = new XMLHttpRequest();
xhr.open("POST","https://api.customer-demo.mfgx.io/orchestration/executeFlow/iosTest" , true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer <API TOKEN HERE>');
xhr.onload = function() {
completion(this.responseText);
}
xhr.send(JSON.stringify(window.location.href));
Wait for the shortcut to become available inside Safari.
It may be necessary to provide permission before running on a web page.
Select the shortcut to call Fuuz.
(Optionally) Display the response as a message.