nfriend / snow-day-notifier

A small Lambda function that scrapes PEI's public schools website and sends alerts (through IFTTT) if school is delayed or closed.

Home Page:https://gitlab.com/nfriend/snow-day-notifier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snow Day Notifier

GitLab build status

A small Lambda function that scrapes PEI's public schools website and sends alerts (through IFTTT) if school is delayed or closed.

A snowflake logo

Deployment of the Lambda function is managed by GitLab CI/CD and the Serverless framework. (See this project's .gitlab-ci.yml and serverless.yml.) This function is scheduled to run every 5 minutes.

When the Lambda function identifies a potential closure, it sends a mobile notification that looks like this:

A notification from IFTTT

Clicking the notification redirects the user to the PEI public schools website to view the full post.

Developing

  1. Clone this repo: git clone git@gitlab.com:nfriend/snow-day-notifier.git
  2. Install dependencies: cd snow-day-notifier && npm install
  3. Run any of the scripts found in this project's package.json, for example: npm run build:watch

Deploying

  1. git push on master

Project setup

This project expect a few CI/CD variables to be in place:

  1. AWS_ACCESS_KEY_ID: The access key ID of your AWS IAM user

  2. AWS_SECRET_ACCESS_KEY: The secret access key of your AWS IAM user

  3. IFTTT_KEY_JSON_ARRAY: A JSON-formatted array of all IFTTT Webhook keys that should be notified if a delay is detected. For example:

    ["ifttt-key-1", "ifttt-key-2"]
  4. AWS_DYNAMO_REGION: The AWS region of your IAM user (e.g. ca-central-1) for usage when setting up a DynamoDB connection

IAM User

When creating the IAM user for this project, grant the user the following permissions:

  • AWSLambdaFullAccess
  • IAMFullAccess
  • AmazonDynamoDBFullAccess
  • AnazonAPIGatewayAdministrator
  • AWSCloudFormationFullAccess

A screenshot of IAM's management console showing the necessary permissions

About

A small Lambda function that scrapes PEI's public schools website and sends alerts (through IFTTT) if school is delayed or closed.

https://gitlab.com/nfriend/snow-day-notifier

License:MIT License


Languages

Language:TypeScript 53.7%Language:JavaScript 46.3%