Run Drafts Action shortcut and data passed to Drafts




I want to implement the following end user workflow. Hit the share button something that will produce a URL, and have that url directly appended to a draft with a particular tag. I’ve been trying to do this via a Siri Shortcut that turns around and uses the Run Drafts Action to invoke a Drafts action. The Drafts action has a single Javascript step. My JS code finds the correct draft and can append some dummy text to it, but I cannot figure out how to take the URL that came from the Share Sheet and Siri Shortcut, and access it in my JS code.


If I understand what you are trying to do, I think you could just create a one step Shortcut in the Shortcuts app that used the “Add to Draft” action in Shortcuts. Set it to append, and enter the UUID of the draft you want to target…then make that shortcut available in the Share sheet.


The problem is that I don’t want to hardwire the UUID of the draft. What data does the “Run Drafts Action” shortcut pass to the drafts action that it runs, and how do I access it? A pointer to the right page of documentation would be fine.


The input from Shortcuts when using “Run Action” is the text of the draft as if you had typed it in Drafts and run an action. So in templates you can use any template tags to use that text, or in script using the Draft object - notably the draft.content will be the full input string passed from Shortcuts.


That’s what I was missing. Works great!