Receive a value from Scriptable in Shortcuts


I’m looking for a way to receive a value from Scriptable in Shortcuts action.
args.all do the way from Shortcuts to Scriptable. Is there any command in reverse direction?


Unfortunately passing data between Shortcuts is not supported by iOS. However there are two workarounds that you can look into.

  1. Use the pasteboard. Both Scriptable and Shortcuts supports manipulating the pasteboard. In Scriptable this is done with the Pasteboard API. When you run a script, you can put a string or image into the pasteboard and read it in Shortcuts. The benefit of this approach is that it doesn’t require Shortcuts or Siri to open scriptable. The next approach does.
  2. Use x-callback-url. Shortcuts supports opening a x-callback-url and processing the result when a third party app invokes x-success. In Scriptable, you can use the URLScheme API to get the x-success URL and the Safari API to open the URL. It looks like the following:


Scriptable script

let params = URLScheme.allParameters()
let baseURL = params["x-success"]
let url = baseURL + "?hello=world&foo=bar"

Can input be passed to Scriptable from Shortcuts app?

I appreciate your detailed guide to work around this issue! I’ll adapt x-callback-url way because it looks straightforward than pasteboard-way.
Feel wretched Apple putting a limit on interconnectivity between Shortcuts and third-party apps. Anyway, we can do this!


Hi, I was looking into a way to pass arguments into the script and as you guys noted above it can’t be done at the moment. However I saw that there is this shortcut action for Pythonista where they can pass input into sys.args

Any idea how they do that? I’m going to try to use it a little bit see if I can find something but you guys work on the scriptable app so you probably have better insight.


It’s built into the URL scheme for Pythonista, which is what Shortcuts is making use of, and sys is a Python module that Pythonista is making use of, with sys.argv being a standard Python construction.

In effect the details above on the x-callback-url for Scriptable are doing the same thing, just grabbing the data string directly. I think you should be able to write a function to process it like the sys module in Pythonista is doing. Just split the return with the parameter returns in the URL.