Drafts - Send to Devonthink not working

I have a problem when using the action “Send to Devonthink” from Drafts into Devonthink. I can’t see the note enter my global inbox in DT, even if I hear a confirmation sound in Drafts that the script has run.

I’m using the official Drafts action for Devonthink integration:

Maybe somebody can tell if the script looks ok:
x-devonthink://createText?title=[[title]]&location=''&text=[[body]]

Have a look in the DT documentation (type “callback” in the Help menu’s text box and select “URL Commands”.
There doesn’t seem to be a command createText. So maybe you should talk to the Drafts people?

There is a command called “createText”. Maybe you need to look a bit further down?

:+1:
Maybe … or perhaps rub the sleep out of my eyes.

So, when I try the action here, it beeps with an empty text. A text containing a title an a body gets imported just fine into DT.

What does Draft’s Action Log tell you?

It says, completed, like everything is fine. But I still can’t see it arrive in DT. Strange.

1 Like

The LOG should say something like:

Opened URL: x-devonthink://createText?title=Lothar%20Ledderose%3A&location=''&text=China%20Schreibt%20Anders%2C%0AAlfred%20Kr%C3%B6ner%20Verlag%2C%0AStuttgart%202021.%0A116%20Seiten%2C%2019%2C90%20Euro.%0A

That’s a lot more than “completed”.

Use the last entry in this menu

Why are you using the location parameter here? That’s the URL of the document, e.g., www.devontechnologies.com. If you’re trying to put the document somewhere specific, you should be using the destination parameter and the destination’s UUID.

PS: Maybe you need to look a bit further down :wink:

This is what I use and it works fine:

x-devonthink://createText?title=[[title]]&location=''&text=[[body]]

You do not have to pass a UURL; it brings up the Group Selector to allow for choosing a destination if no destination is provided.

The question is - why is @stighagen not seeing the Group Selector?

What’s the point of using an empty parameter?

it brings up the Group Selector to allow for choosing a destination.

Yes, I’m aware. But that’s only because a destination parameter hasn’t been provided. That’s what I said above.

1 Like

The original question was about the Drafts action, which is as it is, ie with an empty location. It works ok here, and the interesting question is why it doesn’t for the OP.

It says:

Opened URL: x-devonthink://createMarkdown?title=This%20is%20a%20test&text=&tags=important

That’s invalid as you’ve included no text.

Guess what. After I included a title in Drafts, and made a break, then wrote some more text, then it worked. Hmm…

So it seems that the script strips of the first line for title and is dependant on content under the first line to create content (or at least a break) and ultimately place it in Devonthink. Well that solved the mystery.

Thank you for your assistance!

2 Likes

Using the first line as a title is afaik the usual approach in Drafts.

I also came here troubleshooting silent failure of the action. I’m surprised that DT’s processing of the callback URL will fail if the body is blank (&text=[[body]]). Isn’t an empty text file a valid one?

I changed it to x-devonthink://createText?title=[[title]]&location=''&text=[[draft]] which saves the entire draft as the text. If it’s just a one-line draft, the send to DT will still succeed. I like to have a title line at the top of a text document anyway.

The URL handlers on the Mac are actually only intended for bookmarklets & browser extensions but not for automation. AppleScript or JXA are usually recommended instead.