Return a Value From a X-Callback-Url to a Variable in KM

I am trying to use an x-callback-url which returns a JSON object to set a variable in KM. I understand that for this to work somebody (KM) rshould register a mechanism to handle the x-success callback. Is there such a mechanism? I can't find it. I can do this using the Shortcuts on iOS or Scriptable on iOS. Any suggestions for how to do this on MacOS would be much appreciated.

This has worked well for me.

I use this 5 year old little CLI tool too for getting x-callback data from applications, but I really feel like Keyboard Maestro could easily integrate this functionality more elegantly.

2 Likes

Jumping on this old thread to say: Fortunately, the xcall app still works, but it would be great if Keyboard Maestro could natively support the x-success parameter of the x-callback-url protocol. Please consider this a feature request, @peternlewis.

My immediate use case is to make KM communicate with Drafts — they're the kind of apps that I'd expect to work well together, but Drafts doesn't support much AppleScript and KM doesn't support x-success, so I end up having to use xcall (or Shortcuts) to get the contents of a Drafts note into KM.

It turns out that about three years before the original question in this thread was posted, @unlocked2412 posted an item in the Tips and Tutorials section with nearly exactly the same title as this thread, "Return value from x-callback URLs in macOS", which provides the answer. I'm now using that as the answer to my my question, "Macro to Find a Bear Note with a RegEx?".

I, too, would like a native KBM solution because it would be conceptually "nicer" to not have to depend on a GitHub utility and it would save a couple of actions in my macros. However, based on many interactions with Peter throughout over four year's membership in this forum, I really doubt that it will happen any time soon. There is a straightforward working way to do this that has relatively little overhead. He has many other proplems that he is working on that will have a greater impact to many more KBM users. If martinfinke/xcall disappears and no one creates a replacement, that would substantially increase the likelihood that Peter would consider creating a native KBM solution. Until then, probably not. I can't speak for Peter, that's just my experienced guess.

I did get Peter to implement a native solution to a pet issue of mine. His implementation of the Space Changed Trigger made it possible for me to not have to create an AppleScript Observer to watch for NSWorkspace.activeSpaceDidChangeNotification. The AppleScript solution was complicated and somewhat unreliable. Peter's Space Changed Trigger, introduced in KBM v11.0, just works. Replacing xcall is not (yet) the same kind of issue.