Drafts to Obsidian by Voice - Persistent Strange Issue

Hi folks,
Not sure if this is an issue with Drafts, Shortcuts or Obsidian itself.
I am trying to get items to Obsidian via Drafts using my voice.
On the face of it, sounds very straightforward.
I am using the great “Append in Obsidian” Action for Drafts.
It works well when I am using Drafts itself on either Mac or iOS.

However, I am now trying to set up an iOS shortcut to dictate text by voice, transcribe that text, have that be a new note in Drafts, and then, perform the action Append in Obsidian Daily Note directly on the just-dictated text.

The first steps are simple.
Either, Create Draft by Dictation and then Run Action on Draft or Use built in dictation in Shortcuts, create a new note in Drafts from that text and Run Action etc etc.

However, each time, the Action fails to run properly via iOS Shortcuts.
Initial steps are fine, transcribing text = check, creating a note in drafts = check. Running the action = fail.
Specifically, when the Action “Append in Obsidian” is run, it opens or foregrounds Obsidian App and displays the error “Can’t Find Heading” (I have the Append to drop text under the “Notes” heading on my Obsidian Daily note).

However, if I were to reopen the draft just created from the dictated note…and press the Append in Obisdian command from within Drafts itself, it works just fine.

I presumed then, it has something to do with “activating” or “foregrounding” the just-created note in Drafts in some way to make sending it to Obsidian when it opens… work. I’ve tried that via various permutations of “get current draft” etc. But still, via this automation, the text refuses to go to Obsidian.
And I can’t figure it out. Basically, the “can’t find heading” in Obsidian is the main clue but …it’s not that it can’t find the heading, because it can, manually…but something is getting lost in translation.

I’ve tried so many shortcut options using various different ways to get the text into drafts, with timed delays etc, to ensure drafts text is foregrounded before the “Append” command is activated but never works.
But, Append in Obsidian still works fine when clicked manually within Drafts!
Any advice appreciated!
thanks.

Can you share a link to your shortcut please?

Blind debugging is much slower and much more frustrating than hands on debugging.

If a shortcuts action opens an app, it does not wait for that app to do something to continue, it goes right on with the next step in the shortcut. Both “Create Draft with Dictation” and “Run Action…” open Drafts, and, as such, cannot be used effectively in combination in the same shortcut.

Your best option in this case is to use Shortcuts own Dictate Text action, which will wait for you to complete your dictation and pass that text to the next action - which you can then use the “Run Action on Text” action provided by Drafts to trigger your action and send to Obsidian.

Thanks both.
@sylumer apologies, of course: please find shortcut links
1 = Shortcuts
2 = Shortcuts
@agiletortoise I believe I have tried that unsuccessfully. The current iteration has Shortcuts own dictation action, followed by Run Action. As that didn’t work I tried to ‘foreground’ drafts further by Creating a Draft from the dictated text, get the current draft etc… I’ve tried many permutations including adding delays but no joy. Maybe I am missing something blindly obvious,.

Most of the Drafts shortcut actions that create/find/update drafts return a reference to that draft to Shortcuts, which is what you need to hook up to the subsequent action in Shortcuts - not try to “get current”, etc. The draft you created will not be the current draft, it’s not loaded in the editor or anything when you use background actions in Shortcuts.

So it should look something like the below, which each step connect to the output of the previous one…

1 Like

Tried that @agiletortoise. All linked. Still not working.

https://www.icloud.com/shortcuts/ece5e32ca3934b75b299e04e848793ab

  • The dictated text is being transcribed
  • The note is being created in Drafts
  • The Append To Obsidian Daily Note Action is being triggered (with a green success message).
  • However, on the Obsidian side, its still saying “Can’t Find Heading”.
    I guess its on the Obsidian side of things then?
    However, when I manually run the action in Drafts, it works flawlessly. Thats the frustrating part.
    The Append to Obsidian action works 100% manually…

What is in your Obsidian action? Could be a number of things…like, is your action scripted to use the editor object? If so, that is not referencing the draft because it’s not loaded in the editor when you run from outside the app.

I’m using the Append to Obsidian Daily Note Plugin located here:

The only modification I did to the URL is added a heading in the string:

obsidian://advanced-uri?vault=[[vaultName]]&daily=true&heading=NOTES&data=[[data]]&mode=append

It is not at all obvious to me why that would work differently.

The actual URL that was opened by Drafts should be in the action log after you run the action. Take a look at it and see if it’s different when run in Drafts vs. via the Shortcut.

1 Like

Very interesting! Although I’m not sure what I’m looking at… But for sure, there are differences.
The dictated one did not go to Archive but went instead to trash.
It’s Draft Status in the Action Lot is “Unknown”.
The manual one is fine. Went to Archive etc…

Via Dictation (didn’t work)
Opened Callback URL: obsidian://advanced-uri?vault=My%Vault&daily=true&heading=Tasks&data=%0AThis%20is%20a%20test%20for%20obsidian&mode=append&x-success=drafts5-callback-ignore://ignore/70BE2370-F24B-4E52-B73B-FE3DE5D63518&x-cancel=drafts5-callback-ignore://ignore/70BE2370-F24B-4E52-B73B-FE3DE5D63518&x-error=drafts5-callback-ignore://ignore/70BE2370-F24B-4E52-B73B-FE3DE5D63518&x-source=Drafts
Draft moved to trash

Via Drafts Action Manually (worked)
Opened Callback URL: obsidian://advanced-uri?vault=My%Vault&daily=true&heading=NOTES&data=This%20is%20a%20test%20for%20obsidian%20manually&mode=append&x-success=drafts5-callback-ignore://ignore/C98DE5A7-CC34-4FB9-BDCD-7C98DB18E278&x-cancel=drafts5-callback-ignore://ignore/C98DE5A7-CC34-4FB9-BDCD-7C98DB18E278&x-error=drafts5-callback-ignore://ignore/C98DE5A7-CC34-4FB9-BDCD-7C98DB18E278&x-source=Drafts
Draft archived

Those were not generated by the same action, I suspect. Have you installed the action more than once, and possibly have a different version of it selected in the Shortcut? The heading params are different.

1 Like

OMG, you are so right! That’s it! I had another version on another version on another action group! Mystery solved. (And, as usual human error to blame).
But its working now! And I am delighted!
THANKS! :slight_smile:

1 Like