Might not be super useful but just putting it here just in case it gives someone a headstart. I just use Alfred and don’t necessarily require copying links to notes, although that would be great to have.
The location of the sql DB is ~/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite and the table name is ZICCLOUDSYNCINGOBJECT the contains the ID of the notes. Once you have the IDs, you can just use the x-callback URL I shared above. Although this can only be done on the mac.
The challenge is to get the note identifier. I’ve seen an attempt at a shortcut but it ends up as a very manual process.
Hook can create a link to a note on the Mac but the created link is only usable on the Mac (hook://). I wonder if it would be possible to alter the Hook script to generate a note:// link instead, as that would presumably work on iOS too.
I was thinking of a way script that would dump all note IDs and their title in a new note and that can be used as an index. The problem is this does not work for new notes and the script would need to be executed again get that new notes.
Maybe if we can remotely execute the script on the mac, have it create a new note, or update the index.
Anyway, I think I’m getting too nerdy. It’s also too much hassle to just copy the ID. I’d just use Obsidian or drafts, or even better Bear notes if my use case requires coping note links
Yes… looking at the Hook solution, it’s getting the creation date/time of the note and then including that in a hook:// url. As the creation date/time will be unique within a given account it is a good way of retrieving a particular note. However, without Hook for iOS, it’s Mac only.
The ID of the note doesn’t seem to be accessible via AppleScript or Shortcuts so it’s difficult to think of any other solutions, which is disappointing given Apple have gone to the trouble to create a URL scheme for Apple Notes.
This solution from works up to a point but (I suspect due to a bug in Shortcuts/Apple Notes) no longer works to retrieve the note on iOS. However, I did learn that you can use a URL to reference a shortcut, which is potentially useful.