So I am looking for some information and/or assistance with a Siri Shortcuts automation and DEVONthink ToGo.
I want to get an itemlink from a successful x-callback run, but can’t seem to get the returned JSON/Dictionary from the x-callback success. I have asked about this before, but I have never really received an answer or what I might be doing wrong. Am I just missing something very basic?
I know this works with shortcuts others have built, but I can’t seem to get a return value.
Is there something basic I am missing to get the itemlink back as a success value? I know I can Get value from Dictionary but at this point I am just trying to see what is returned at all - that is why I am just trying to get the content graph (or show result).
Basically I am just looking to capture something into Devonthink and get an itemlink in return (to clipboard or some other destination).
Though using an x-callback-url shouldn’t be used in all cases, it must in this one since you want a value returned to Shortcuts for inspection. Therefore your URL must be x-devonthink://x-callback-url/create…
In this instance a dictionary is already returned, so just get the content graph of the return of opening the URL.
This small detail seems to be consistent throughout all the shortcuts I have that aren’t working. I thought it didn’t make a difference as long as I used the Open X-Callback action in shortcuts. I thought that was the trigger. I am wrong. Thank you. I will test and repost if that was the issue. But seems to be the case. Will this work with all item creations through the url scheme. In other words I can get the item link regardless of item I add? Or is it limited to certain file types?
Followup: I was able to reproduce the working example above. Looks great. Thank you.
However, let me give you a simple problem, with a complex shortcut that is at the root of the issue here.
I am switching a single action in the shortcut made by another DT user (@ryanjamurphy) - post about this shortcut somewhere on the forum (couldn’t find it). I am switching one action - URL to Open x-callback URL. Everything else is the same. But the shortcut will not add the item to DEVONthink after making the change. And of course, being unable to get the itemlink because it does not complete that action.
But when I clip a webpage by running “DEVONsave” shortcut, it runs the “Article to HTML” shortcut which ends with a open URL action. This all works fine. However, if I swap out the last action in the “Article to HTML” shortcut to Open x-callback URL the shortcut doesn’t complete. The file size upon completion is not large (it saves using the working method as 6.8kb).
Ahoy! I think this is a simple fix, if I understand your issue correctly.
The Article to HTML for DT using createdocument shortcut is only meant to feed a resulting URL back into the DEVONsave shortcut. That URL is then used in a Open URL with x-callback action. Providing you’re still giving a valid URL to the Open action, you then need to run a Get Dictionary Value action, using key value itemlink and targeting the X-Callback Result from the Open URL with x-callback action.
But all of this is a little hard to explain and depends on exactly what your situation is. Mind sharing the edited shortcut you have?
Let me just explain briefly. What I am trying to do with your shortcut is to make it a part of a larger suite of shortcuts that I have designed for capturing thoughts and information. The capture ‘classes’ - so to speak - are “Thoughts,” “Ideas,” “Questions,” “Tasks,” “Projects,” “Tweets,” “Web Clippings” (in markdown), etc. The ultimate end is for all of this information to make it into my Daily Notes in Obsidian (or frankly whatever knowledge management software I am using). During my morning review I use a shortcut to draw all of the prior captures (from whenever the last time I ran the shortcut) into a large markdown document that is pasted into my daily notes - as a kind of Capture Inbox. I have this all built in drafts, but I want to incorporate my large body of resources in DEVONThink and move away from Drafts.
With your shortcut, I was going to use it as a “Web Clipper” to draw in text from articles, snippets, or quotes. My primary concern is getting the itemlink so that in my daily Capture Inbox I have a markdown link to the file/snippet/text in DEVONthink. Ideally, I will also want to choose whether to draw in a whole article, excerpt, or just the link to the full text in DT.
Now I can do the vast majority of this, but I can’t get your shortcut to return an Itemlink that I can format to be pasted into my Capture Inbox.
I hope that makes sense. Your explanation helped me understand the relationship between the two shortcuts.
I just can’t figure out the success dictionary return when running the “Article to HTML” portion of the shortcut. Because that shortcut doesn’t return a value, I don’t know where to find it. Though in your comments above are you suggesting that I can retrieve the value somehwhere in the DEVONsave shortcut? I can run a straightforward DT x-callback, I just can’t get it out of yours after save the nice fancy HTML into DT.
I might have to chalk this one up to a bug! It seems if you run the Article to HTML shortcut from within Shortcuts—i.e., you add a Continue in Shortcuts App action to the beginning—it works fine. Again, providing you have a URL→Open URL in x-callback→Get dictionary value for "itemlink" in X-Callback Result chain at the end.
I was able to reproduce the behaviour you’re seeing (i.e., no resulting item link) and couldn’t get anything to show until I added Continue in Shortcuts App for debugging. How odd.