Drafts action to send a draft into an Obsidian vault

Hi all,

I’ve improved upon an existing action for the Drafts app.
You can find it → here

Short description :

  • The Obsidian note’s filename is either the title or the creation date-time of the draft, depending upon the draft beginning with a header or not.
  • A YAML header is added with the creation date and time of the draft.
  • The tags are written at the end of the note, under a separator line.
  • The vault name is an editable constant.

In practice :

  • If you start your draft with a #, it means that the first line is a header — it doesn’t matter how many # there are.

    • In this case, the filename of the Obsidian note is derived from the header.
  • If the first caracter of the draft is NOT a #, the first line won’t be the note’s filename. Instead, the filename will be the creation date and time of the draft, in ISO format.

In any case :

  • A YAML metadata header is added at the top of the note, with an entry with the creation date and time of the draft.
  • The draft tags are added at the bottom of the note, below a separator line.

Illustration and use case

You have a “quick idea” and you capture it into a Drafts note.

  • If you have an idea for a title for your note, you write it on the first line:

CleanShot 2021-07-17 at 22.08.04

  • In Obsidian, it lands like this :

CleanShot 2021-07-17 at 22.11.09

  • If you don’t give a title to your note, it doesn’t matter:

CleanShot 2021-07-17 at 22.09.02

  • In Obsidian, you’ll have a unique note anyway :

CleanShot 2021-07-17 at 22.10.00

The #post-it tag will allow you to find all your post-its in your vault. It’s just a hint.

Olivier Spinnler

2 Likes

This is so helpful! Thank you!

Hi Olivier.

I am a complete newby in this coding adventure.
Your action is the one I was looking for.
Unfortunatly, I can not making it work.
The reason is the vault is not found.

I want to get the note in following vault:

iCloud/Obsidian/Draftnotes

What do I did wrong?

Hey, seems to work good on desktop, Thanks.

Not so much on the mobile versions?
I’m using iOS 16, latest obsidian and drafts versions.

It seems to go as far as opening Obsidian, then nothing more?

Maybe I am missing something.