Take quick daily notes to Obsidian from iOS

EDIT:
2020-11-15 - Added 2 options for the solution

Problem:
Obsidian daily notes are great. I can drop anything in a daily note without worrying about the structure too much and then link from or to other resources when needed. I keep my daily notes in Daily Notes folder in my vault and the files are named in this format “yyyy-MM-dd”.

The problem I had, when I had a quick idea or learned something new, it took way too many steps to open Obsidian on my laptop, open the daily note and write. I needed something that works from my iPhone, but there is no mobile app for Obsidian.

Solution:
I want to share a super convenient shortcut to add quick note to Obsidian daily notes from your iOS (sorry Android users, maybe something similar exists).

Whenever I have an idea or learn something, I tap on a shortcut icon on my iPhone home-screen, type the note and send it.

Here is how it works:
https://video.twimg.com/ext_tw_video/1327616936507797504/pu/pl/ytghUsCm02v7N-uk.m3u8?tag=10&descending=true

And this is how every single note you add will nicely append to today’s file:

How to make it?

Option 1:
If you want to store notes in a custom folder on your Mac through iCloud. See Option 2 if you are okay using Dropbox.

To build this solution I’ve used Shortcuts and Scriptable apps on iOS. The scriptable app is needed to access local files on iCloud. Using only Shortcuts app you can only save to iCloud/Shortcuts folder. And that’s not where my Obsidian vault is.

Link to the Shortcut:

Scriptable Javascript code:

// A new file manager on iCloud
var fm = FileManager.iCloud()
 
// Get the file content from Shortcuts
var newContent = args.shortcutParameter
 
// Get the filename type parameter from Shortcuts
// This is just yyyy-MM-dd.md by default, can be changed in the Shortcuts app
var filename = args.plainTexts[0] + ".md"
 
// "Daily Notes" is the name of the folder bookmark you created in Scriptable > Settings > File Bookmarks
var path = fm.joinPath(fm.bookmarkedPath("Daily Notes"), filename)
 
// Check if the file already exists
if (fm.fileExists(path)) { 
  // Get file contents
  var oldContent = fm.readString(path)
  // Append new content to the old content in the file
  var content = oldContent + "\n" + newContent
} else {
  // If the file does not exist, the content is the new content
  var content = newContent
}
 
// Write the file content to iCloud
fm.writeString(path, content)
 
// Tell Shortcuts that we're done (not strictly necessary)
Script.complete()

Bonus: the way I build the Shortcut, you can also select any text on Web, tap Share button and then tap your Shortcut. This will pre-fill the selected text as a content for a quick note.

Option 2
If you prefer to store notes on Dropbox or “iCloud/Shortcuts” path. But you won’t be able to store notes in a custom folder on your Mac.

In this case you don’t even need the Scriptable app. You only need to use iOS Shortcuts app and use “Append to File” component and select “Dropbox” as a service.


(Source: https://twitter.com/geetstechhabits/status/1325587596869734400?s=21)

Let me know if you found this useful and if you know ways to make it even better!:blush:

22 Likes

This is exactly what I have been looking for.

Will try it out when I’m back in my office later today and give you some feedback.

Thanks for posting!

1 Like

Awesome work @edgarasben. Just took a look at the Scriptable documentation. Am I correct in the assumption that this would only work with a vault stored in iCloud? The Scriptable FileManager API doesn’t seem to have a provider for other storage. It would be cool if it could use the iOS Files API and be able to access the other storage providers (Dropbox, OneDrive, etc.).

@fluxium I am not sure if Scriptable can access other storage providers.

But, you can actually do the same thing what I did to Dropbox much easier. You just need to use Shortcuts app without Scriptable and use “Append to File” component and select “Dropbox” as a service.


(Source: https://twitter.com/geetstechhabits/status/1325587596869734400?s=21)

The only reason I used Scriptable was because I wanted to store notes in a custom folder on my Mac, where Obsidian vault lives, instead of “iCloud/Shortcuts/…” or Dropbox.

2 Likes

This is very good … thank you.

1 Like

Excellent! Solved all my needs.

1 Like

Very cool use of Workflows. Paired with dictation it’s an excellent on the go solution.

I modified @edgarasben’s workflow to add current date time and line breaks which is working well.

The UX is a bit confusing but if you tap on “Provided Input” a select menu opens but you can tap on the little keyboard on the left of the screen. That allows you to modify what you’re appending. CurrentDate is a default variable with a specifiable format. You can insert it there. I also create a LineBreak variable to insert two before the entry and one after the currentdate.

3 Likes

Amazing - thank you!!! :raised_hands:t4::sparkles:

1 Like

Thank you for sharing this!

Any idea why I might be getting duplicate notes, instead of having my entires append to the same note? For example, it is creating 2021-01-05, 2021-01-05 2, and 2021-01-05 3.

I’m sure it’s user error. It appeared there were a couple items the user has to configure, so I stumbled around trying to do so.

Very charming! Thanks for this.

1 Like

I remember having this issue. But I don’t remember how I soved it. Sorry. I will write if I do.

Hi @Evan. This started to happen to me, too. It was working correctly yesterday and I believe haven’t changed anything in the script. Very odd.
Did you get it to work properly?

I am having some issues recently with iCloud. It’s syncing for DAYS… I believe this could be one of the issues with duplicate files.

Hi Ari. Sorry, I’ve been away from the forum for a while (and my Obisidian usage has dropped, too). I never did figure this out.