Code Monkey home page Code Monkey logo

traverseical's Introduction

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

traverseical's People

Contributors

mrsimonc avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.