Setting %TriggerValue% in an HTTP request

I am trying to figure out how to pass data into a macro that was triggered using a remote web trigger. I want to do this using a Mac Shortcut. A question similar to this was asked by @Danny_Pettiona when using an app called Integromat. @peternlewis responded that the %TriggerValue% could be set using a HTTP GET request to the remote KM macro. (see: POST Webhook to Keyboard Maestro - #7 by peternlewis). The value is passed in Integromat by manipulating the "Query String" field in the HTTP request.

I don't have the Integromat app but would like to do this in Mac Shortcuts. Shortcuts allows you to specify a HTTP GET request with a custom header but I don't know if this is the method for setting the macro %TriggerValue%.

What is KM expecting to be sent in a HTTP PUT request order to set %TriggerValue% ? If someone can provide a CURL example maybe I can figure out how to implement that in Mac Shortcuts.

If you want to execute a macro from Shortcuts, just use AppleScript. Shortcuts can execute an AppleScript, and the AppleScript can trigger the macro.

In the macro, select AppleScript from the Or by script popup menu for the requisite AppleScript including how to send a parameter (though I'm not sure how you do parameters in Shortcuts).

I wish I could just run an AppleScript. Something I forgot to mention is that I want to run a Shortcut as part of a HomeKit automation. When you do this, you are not presented with all of the Shortcuts features that are available on a Mac,. This is because the automation runs on whatever hardware happens to be the HomeKit hub at that time. It could be an iPhone, iPad AppleTV or HomePod. Unfortunately AppleScript is not available on the dumber HomeKit hubs. So I think my only option is to use the HTTP request to pass data into a KM macro since HTTP is available on all hub platforms.

Big picture is that I'm trying to setup a HomeKit automation that fires off a KM macro whenever a temp sensor drops below a specific value. When the sensor triggers, I'd like to pass a couple of values like temp and humidity into a KM macro.

Sorry I was not clear about the HomeKit thing.

1 Like