How to trigger NodeJS service based on user's calendar event

Viewed 170

I am trying to allow a user to log in to a web app with their calendar service (eg. Google Calendar, Outlook) and then whenever one of their calendar events start or end, I want a NodeJS service to be triggered.

My thinking was to try to use pipedream.com (though only an idea, very happy to use another approach) in the following fashion:

1. User logs in to their calendar service via my web app, or perhaps provides a webhook or equivalent
2. I store their calendar credentials and then pass them to a service such as Pipedream
3. On calendar event start or end, Pipedream then triggers my NodeJS service

I am stuck working out how I can pass the user's calendar credentials/webhook to Pipedream, as it requires login at the point of setup: Screenshot of Pipedream

Any help would be much appreciated!

1 Answers

Firebase cloud functions would be a good solution here. The Cloud Functions triggers allow execution of a serverless node.js function to be triggered at a specific time, in a very simple way:

exports.scheduledFunctionCrontab = functions.pubsub.schedule('5 11 * * *')
  .timeZone('America/New_York') // Users can choose timezone - default is America/Los_Angeles
  .onRun((context) => {
  console.log('This will be run every day at 11:05 AM Eastern!');
  return null;
});

The big advantage is that you only pay for the execution time of your function, so you don't need to worry about a server sitting idle until the time of the meeting (which triggers the function).

Related