Git Product home page Git Product logo

node-event-reminder's Introduction

Node Event Reminder

Just a small node app running a cron to trigger SMS and email event reminders for birthdays, MOTs etc.

Sends reminders via any/all of the below:

  • Email (Nodemailer)
  • SMS (Twilio)
  • WhatsApp (Twilio Beta)

Data sources:

  • Local .json file
  • Google Calendar API

Notes

This was created largely for my use case so hasn't been developed as a configurable package, however I think it should be fairly easy to adapt to your own purposes due to its modular build and easily swapped out account variables.

Cron

  • The app runs a cron to trigger the reminder functionality at specific times, using the node-cron package.
  • The cron schedule is easily configurable via the crons.js file.
  • Each successful cron event is logged to a txt file.
  • If running the Node app on a Linux server then the timezone needs to be set to match the cron schedule. You can use dpkg-reconfigure tzdata on Ubuntu. date to check.

Google Calendar

  • The Google Calendar integration requires a Service Account signed up to the Calendar API via the Google Developer Console.
  • The Service Account needs to have access to your private calendar - share your calendar with the Service Account via the calendar itself.
  • A 'credentials.json' file is required to authenticate with the Google Auth library used. You can find an example of what this should look like here. You could also use ENV variables for this. Obviously remember to gitignore!
  • The Google documentation around auth isn't great, particularly when trying to authenticate server to server :/
  • Currently set up to only pull events from the calendar that include the string 'notifyme' somewhere. This can be easily changed!

Local Data

  • As well as pulling from Google Calendar, the app can also pull from a local .json file. An example of the structure it requires is provided in data-example.json.
  • When the app is running, any changes to the a file within the data folder will trigger a backup to be taken in a separate folder to prevent accidental loss of data. 30 backups are kept.
  • The various log files need to be created in the logs folder when you set up the app or the process will fail.

Twilio

  • You'll need an account with Twilio, but if usage is low then the trial tier is fine.
  • ENV variables for the Twilio SID and Auth Token are needed plus private variables for your phone number and the Twilio sender numbers. Twilio have some pretty good guides available.
  • A log file is used to log the status of message requests.

Nodemailer

  • Nodemailer needs to have an SMTP transporter object created. This could be something like Mailgun, SendGrid etc. but I am using Gmail. For higher usage you would need a dedicated SMTP solution.

Environment variables

  • These are required for the 3rd party integrations and also to determine which combination of data source and services are used.
  • Please see .env.example for a list of the fields used.

TODO?

  • Add a basic auth-locked settings page to allow add/edit/delete of events. Nuxt?

node-event-reminder's People

Contributors

chrispxpx avatar dependabot[bot] avatar recidvst avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

moinnn

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.