My first version of the this shortcut worked great for getting a new text note into DEVONthink. I run the shortcut from Siri and from my home screen. This is an improved version that uses an x-call-back URL to open the note in DEVONthink after it is created.
The new modification is for handling the call back URL and extracting the document ID from the DEVONthink response.
We trigger an x-call-back-url in the shortcut and we wait for the URL to return from DEVONthink. This URL creates a new Markdown file.:
::: js x-devonthink://x-callback-url/createMarkdown?<destination>&title=<URL Encoded Text>&text=<URL Encoded Text>
When the DEVONthink URL finishes creating the new Markdown file it returns to the source app (Shortcuts) and includes a dictionary of information about the newly created file. One of the keys it returns is “itemlink” which is another URL that points to the new Markdown file. At the end, the shortcut grabs this new URL and then opens it again.
It seems like a really dumb roundtrip and it is. It’s a silly little dance between DEVONthink and Shortcuts, but it accomplishes what I wanted. I now have a quick way to create a Markdown note in one of my preferred groups and then keep the note open for editing.
I also think it’s a nice use of Shortcuts to bridge a simple gap in an app that I otherwise think is great.