Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
/ TraverseiCal Public archive

Monitor Apple Calendar for new entries, send interactive notification, add to Todoist list if human approves

Notifications You must be signed in to change notification settings

MrSimonC/TraverseiCal

Repository files navigation

Traverse Calendar

Traverse an iCal Feed, observe (and remember) any new events. Then notify someone of this new event, asking if they want this event tracked. If yes, then add the event to a Todoist list.

Background

Following on from the my previous project TodoistDaysRemaining (where I have a Todoist list I manually populate which then an Azure Function updates the days remaining), I wanted to remove the manual step of typing out new calendar events.

My wife and I have a joint Apple Calendar we share, so we can both add events to it. However, some events are more important than others: some I'll want to track and count down the days remaining. Having something to monitor this, but ask if we want an event tracked - then auto-adding it is super powerful.

Technical breakdown

Diagram

diagram

Explanation

Wanting to learn primarily how to access Durable Entites in a Durable Orchestration (and Human Interraction Durable Orchestrations pattern), I built this in 5 nights (evenings, as I have children/work which zaps all my time in the day)! This features:

  • A Durable Orchestrator Function
  • A Durable Entity (aka Entity Function)
  • Prowl App (for notifications)
  • Apple Shortcuts app (optional - but saves me closing a browser tab on each reply)

In short, a timer/http function will kick off the orchestration. We then get the ical feed into memory, either memorise all of it (if on our first run) to an entity function, or compare those known events to these incomming ones. We then use the brilliant WaitForExternalEvent in Durable Orchestrations to wait for a response. At this point, my iPhone will have a Prowl App notification with a shortcut:// url attached. When launched, this runs an Apple Shortcut which asks the user to approve/ignore, and if approved, will call a normal Azure Function (technically not needed) which will raise an event to the Orchestrator. The Orchestrator then contacts Todoist, adds the entry (and date).

After all this has occurred my original TodoistDaysRemaining system will pick up the event and update it with days remaining.

Environment Variables

  • HTTPS_ICAL_FEED - the share link from apple calendar (which starts "webcal", so change that to "https") e.g. https://p11-caldav.icloud.com/published/1/...
  • PROWL_API_KEY - your prowl API key e.g. 123456789
  • TODOIST_API_KEY - your Todoist API key e.g. a0123456789
  • TODOIST_LIST - name of your Todoist list e.g. "my list"
  • RAISE_APPROVAL_EVENT_URL - Azure url (with no ending slash) to your Azure function which handles approvals "http:///api/RaiseApprovalEvent
  • USE_APPLE_SHORTCUTS - true/false. If True, this will send the Orchestration Instance Id to a shortcut named "Raise Event". If false, then two prowl messages will be sent - each with their own link to approve/ignore the event

Releases

No releases published

Packages

No packages published

Languages