Pull Daily Logs from Drafts into Obsidian by clicking a button (works great with the Drafts Watch Complication)

Drafts has a great Apple Watch complication that allows you to dictate text really easily from your wrist. I wanted to create a way that allows me to do interstitial journaling on my watch through drafts and then easily import them into my daily notes in Obsidian at the end of the day with the click of a button.

Requirements

I managed to succeed, and it works very well. To replicate the workflow you will need the following:

  • A working understanding of the Drafts Application and the watch complication and drafts actions.
  • The Drafts App with a Pro Subscription so you can use Drafts Actions
  • IOS or Mac
  • Obsidian with Daily Notes enabled
  • Advanced URI Plugin for Obsidian
  • The below are Optional but make the workflow more fun:
    • The MacStories Shortcuts Launcher Plugin for Obsidian
    • The Buttons Plugin for Obsidian

The Setup

Here is a tip before we start. Create a few new Drafts entries to test with.

Step 1: Drafts to Obsidian Action

The first thing we need is a Drafts Action that will append a draft to our Obsidian Daily Note. I chose to use one that utilises the Obsidian Advanced URI because it makes things a lot easier. This is the action I decided to use: Append to Obsidian Daily Note | Drafts Directory

We need to make a few edits to the action. For testing purposes, change the after success action to, “Do nothing” (the default is to delete them). This way we don’t have to recreate our test Drafts every time we test. You can decide what you want this to be once you have everything working.

Next, we can tweak how we want the raw Draft transformed for when it pushes into Obsidian. Do this by editing the data tag template. This is ultimately up to you, but I added a “-” so that each entry is bulleted and a timestamp based on the creation date of the Draft.

Next add the name of the vault with your daily notes to the vaultName tag. And we’re done.

Test the action on one of your Test Drafts to see that it pushes through to your Daily note correctly. If it does, we are ready to move forward.

Step 2: Creating a Daily Log Workspace

The next step is to create a Workspace in Drafts that will query only our daily log drafts. This will be essential for the IOS shortcut we create later.

I my configuration is below. The main component is defining the filter of the start and end date. This will ensure that we are only pulling through logs that were created today. The tag filter is optional but very useful if you use drafts for more than daily logging. The tag filtering may also give you other ideas of how this could be used for different types of notes beyond daily logging. Set both to relative 0 days and enable query date.

Step 3: Creating the IOS Shortcut

Next we will create the IOS shortcut that will run the Draft Action on all of the drafts in our newly created workspace. Good news, it’s a super clean shortcut. It queries our daily log workspace, then runs our append draft to Obsidian daily note action on each of the returned Drafts. I would share an iCloud link, but it’s actually a lot easier to setup yourself based on the screenshot.

Run the shortcut and test that it pushes all of the desired drafts to your Obsidian daily note. If it works, congratulations! You now have a great way to send your draft daily logs to Obsidian. The next step will just make the process a bit sexier.

Step 4: Running the IOS Shortcut within from your Daily Note

I love the idea of going into my daily note at the end of the day, being able to press a button, and it will pull all of my daily logs in. We’re going to set this up now.

There is a fantastic new plugin called Shortcut Launcher courtesy of Finn Voorhees and @viticci of MacStories. It allows you to run IOS shortcuts from within Obsidian. Install the plugin. My setup is below. The action name can be whatever you want. The Shortcut Name MUST match the name of the shortcut we just made. Think of it as an ID.

We aren’t providing an input in this case, as we are not sending variables out of Obsidian, so just leave it as Selected Text. Save, then test your newly created command via the command palette. If it works, we are on the home stretch.

Next we are going to create a button that we can add to our Daily Notes template. This is the last step before you’ll be living that “click of a button” life. Make sure you have the Buttons plugin installed. Below is the code I used. Replace my action name with the one you made using Shortcut Launcher:

name Pull Daily Log
type command
action Shortcut Launcher: Pull Daily Log
color blue

Test the button. Add the button code to your daily notes template and you’re done! Daily logs from Drafts to Obsidian with the click of a button.

One annoying thing

One annoying thing about this workflow is that the log entries import into Obsidian in reverse order. I haven’t figured out how to fix this yet. If anyone has ideas, I would love to hear them. For the moment, my workaround is to use the Sort and Permute Plugin to reverse the order of the lines once they are imported.

Share your ideas

There are lots of different ways you could use this workflow beyond daily notes. Changing up the workspaces by using tags offers up a lot of possibilities. Please feel free to share your ideas or workflows here.

13 Likes

For anyone who is interested, this is how I worked through figuring out how to do this:

Planning

What am I trying to accomplish with this project?

Drafts has a great Apple Watch complication that allows you to dictate text really easily from your wrist. I want to create a way that allows me to do interstitial journaling on my watch through drafts and then easily import them into my daily notes at the end of the day with the click of a button.

Why is this project important?

Journaling is what I use Obsidian for the most. This would give me another low friction way to log my day and get more out of the process.

What is my minimum baseline target?

  • [x] Have an IOS shortcut that will push all notes created today into my Obsidian daily note
  • [x] A button using [[Federico Veticci]]'s Shortcut Launcher plugin to run the shortcut from within my daily note

What is my stretch target?

  • [x] Have the shortcut ignore certain notes based on tags present in the note
  • [x] Have the shortcut add a timestamp based on the creation date of the note in drafts

Resources


Taking Action

Actions

  • [x] How do I append to Obsidian daily note through draft actions?
  • [x] Need to add a bullet point to the appended text
    • Too easy. Just added the - in front of the draft template
  • [x] Make the action/shortcut include all drafts created today and push to Obsidian daily note
    • Will look to see if [[Thought Asylum]] has created any basic actions I can use as a base
    • Could be something I need to do in shortcuts?
    • Found this action from [[Thought Asylum]] (Today's Drafts to New Draft | Drafts Directory) that Merges all drafts created today into a single note by first creating a temporary workspace. I just don’t want to merge because that will reset the creation date
    • Found this script from [[Thought Asylum]] that will allow me to run a specific action on every note in a specified workspace ([Pending] Automatically run action on a Workspace on a scheduled basis - #4 by sylumer - Actions - Help & Questions - Drafts Community)
    • Waaaaay overthinking it. I can create a workspace in Drafts that queries my inbox by date and by the log tag.
    • Now I can either run the repeat action within the script or through shortcuts. I may test both and see which is most reliable and fast.
      • The shortcut version works incredibly well and with no issues. I’ll stick with that.
  • [x] Add timestamp to entry
    • Timestamp was included in: Append to Obsidian Journal | Drafts Directory
    • Not sure whether the timestamp is based on creation date or time added to Obsidian
    • To change the time stamp to creation I just changed “time” to “created”
    • Don’t understand the timestamp syntax and I want it to be 24h
    • Found this: http://strftime.net which helps build the correct dat syntax for Drafts
      • The syntax is [created|%R] or [created|%H:%M]
    • DONE!
  • [x] Add the Shortcut to Obsidian using Shortcut Launcher
    • So easy. Awesome plugin
  • [x] Create a button that runs the shortcut command and add to daily template
    • Easy
  • [ ] Make it so the order is correct when importing into Obsidian
    • This may require me to build this into the action rather than have it run through the shortcut. Frustrating.
    • Current workaround is to use the Sort and Permute Plugin and use the reverse lines command. Not ideal, but it will do for now.
7 Likes

Regarding your “One annoying thing”, I believe the Drafts Workspace settings allow you to determine sort order for the Inbox folder. If you set it to “Created > Sort Ascending”, you may have better luck.

Thanks for writing this out so thoroughly. It’s exactly what I was looking for.

I’m late to the party but this is gold! Thank you very much!

I figured out a way to one-way copy&replace all my draft notes from apple watch into the respective Obsidian notes.
If anyone is interested how, let me know :slight_smile:

1 Like

I’ve made a lot of improvements to this workflow since I originally wrote this up. The main improvement is that there is a lot less dancing that that happens between apps.

I’d be interested to see how your approach.

1 Like

Well my approach is rather crude as I’m not much of a coder, but it works.
I’m also very interested in the improvements that you’ve made, as I want to rework my workflow a bit.

This is my setup:

I have a few notes where I want to be able to add ideas in the Drafts Apple Watch app (particularly at night, where I have a no-phone-policy). I want these notes to be in sync with the equivalent notes in Obsidian.

In Drafts I have an action (called “Replace Drafts note in Obsidian”) that copies (and replaces) a note using the note tag as filename into an Obsidian folder, using Draft’s bookmark feature. (see screenshot)

I also have a Workspace that contains all the notes I want to sync to Obsidian, by using tag filter and including the relevant tags.

Then I use an iOS shortcut (Called “Drafts to Obsidian sync”) that takes all the Draft notes from the Workspace and applies the “Replace Drafts note in Obsidian” action to them.

The result is that all the relevant notes in Obsidian get replaced with the current Drafts version.

If I change something in the Obsidian note and want to sync it back to Drafts, I have a slightly hacky iOS shortcut for that too, I can post it here if you want :wink:

As a sidenote: The “Drafts to Obsidian sync” iOS shortcut also copies the Drafts note into the iCloud folder of the app “Notebooks”, which then syncs these notes onto my watch, so I can read relevant Obsidian notes directly on my Apple Watch without Drafts’ text length restrictions.

Please let me know if I explained anything unclearly.

(EDIT: Of course this is all based on your above workflow, I have just modified a few parts.)