Action
Execute Shortcut Locally or Pushcut
If on iOS directy run a shortcut. If on MacOS use pushcut.io automation server to run shortcut.
Set the Shortcut to run using the Shortcut Template Tag
Steps
-
defineTemplateTag
name Shortcut
template My super awesome shortcut
-
runShortcut (iOS only)
shortcutName [[Shortcut]]
waitForResponse false
-
script (macOS only)
/* Execute Shortcut using Pushcut automation server */ // First run, you will be prompted for // Puscut.io API Key generated in Account -> Integrations -> Add API Key // Heavy borrowing from all the actions I could find that POST using HTTP.request() and // actions that pass around JSON data. var credential = Credential.create("pushcut.io", "Puscut.io API Key generated in Account -> Integrations -> Add API Key"); credential.addTextField("apikey", "API Key"); credential.authorize(); var apikey = credential.getValue("apikey"); // Setup micro.blog API and content var endpoint = "https://api.pushcut.io/v1/execute"; var content = draft.content; var data = { "input" : content}; // create and post HTTP request var http = HTTP.create(); var response = http.request({ "url": endpoint, "method": "POST", "encoding": "json", "parameters": { "shortcut": draft.getTemplateTag("Shortcut") }, "data": data, "headers": { "API-Key": apikey } }); // console.log("Response: " + response.statusCode); // console.log("Data: " + JSON.stringify(data)); if (response.statusCode != 200 && response.statusCode != 202) { context.fail(); }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.