iCal Daily Schedule via iOS/OSX Shortcut

I was previously using Templater to call icalBuddy from the shell, which would replace a custom template command with my schedule from ical. But this doesn’t work on mobile (no shell) and I primarily start my day from my iPhone or iPad.

I wrote an iOS shortcut (which also works on my Mac) that will pull all of the events out of a particular calendar for a particular day, format them, and send them back to Obsidian. Paired with the Advanced URI plugin (which lets you do regret search and replace via a URL scheme) and the Buttons plugin (which I use to trigger the shortcut), I’ve got a solution that puts my calendar events onto a daily note that works on iPhone and Mac.

Here is a link to the shortcut:

https://www.icloud.com/shortcuts/4d98c0797e7d40bb8cea6da87f3692d1

To use it, you need to call the URL from Obsidian that looks like this:

shortcuts://run-shortcut?name=Get%20Events%20List&input=2022-01-18/EVENTS_GO_HERE

The date (2022-01-18, above) in the URL is the date on the calendar that it gets events for. The “EVENTS_GO_HERE” is the text in the current file that is replaced with the list of events.

I combined this with a clever use of regex and the Buttons plugin, and put this in my daily template (using Templater to write the current date):

EVENTS_GO_HERE

```button
name Get Events
type link
action shortcuts://run-shortcut?name=Get%20Events%20List&input=<% tp.date.now() %>/EVENTS_.{2}_HERE
\```

The “EVENTS_GO_HERE” at the top is replaced with a list of events when you click the button. The button is not destroyed after the action is complete.

This would probably work with just a regular link, too, if you didn’t want to use the Buttons plugin. I think if you got creative with the regex, you could get it to replace the link itself.

I had searched all over for something that does this, and most people seem to want to create their whole new note from a shortcut. I want to create my notes in Obsidian and feed it data. Like I said, the icalBuddy solution works, but not on mobile, whereas this one does work on the iPhone. I hope this is useful for someone.

A Templater custom script that would do this automatically when a template was applied (like via <% tp.user.shortcut(‘Get Event List’, ‘2022-01-08’) %>) would be extra sweet if someone could figure that out. No extra clicks!

4 Likes