Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

CityofEdmonton/IFTTT-Edmonton

Repository files navigation

Coverage Status

Edmonton IFTTT Triggers and Applets

This repository houses Edmonton's IFTTT applets, triggers and actions. IFTTT is a free platform that helps you do more with all your apps and devices.

Triggers

IFTTT triggers cause IFTTT actions to occur. Sometimes, a value changing somewhere is a trigger. Other times, someone making changes to a Google Document triggers an action.

Light the Bridge

This triggers when the color on the High-level bridge changes.

Edmonton AQH Index

Pulled from here. When the air index changes, IFTTT actions can be triggered.

Edmonton AQH Risk

Also pulled from here. When the air quality risk changes, IFTTT actions are triggered.

Alberta AQH Index

Using a trigger field for all Albertan cities, we can trigger based on the air index for the given city.

See here.

Alberta AQH Risk

Using a trigger field for all Albertan cities, we can trigger based on the air risk for the given city.

See here.

Deployment

These are deployed using Heroku.

Environment Variables

These variables configure the application.

Variable Description Default value
REDIS_PORT Redis' port 6379
REDIS_HOST Redis' host localhost
REDIS_PASSWORD Redis' password myPassword
AIR_QUALITY_URL The URL GoA exposes their air quality service on https://data.environment.alberta.ca/Services/AirQualityV2/AQHIsource.svc/CommunityAQHIs
LTB_URL The URL we use for pulling light the bridge tweets from https://twitrss.me/twitter_search_to_rss/?term=LighttheBridge%20from:CityofEdmonton
MAX_RESULTS The maximum number of logs to keep for each Redis key 5
IFTTT_SERVICE_KEY The IFTTT service key to use REQUIRED

Contributing

If you're interested in running this on your machine, follow this guide!

Technology

Node.js Express Redis

Basic dependencies

This IFTTT applet makes use of Node.js. The currently recommended version to develop with is Node v9.11.1, so ensure you have that installed. We also recommend Docker for running Redis easily.

Running it locally

  1. Install your dependencies by running npm install.
  2. Run docker-compose up to start Redis.
  3. Run npm run start to run the API on port 5000.
  4. Set the IFTTT_SERVICE_KEY environment variable

Mac OS

Run export IFTTT_SERVICE_KEY=myservicekey

Windows

PowerShell: $env:IFTTT_SERVICE_KEY="myservicekey" (This will only persist for the current PowerShell process)
Command Prompt: setx IFTTT_SERVICE_KEY myservicekey

Note that you must include the value myservicekey for the key IFTTT-Service-Key in the header of requests made to the service, even in local development.

Debugging

We recommend using VS Code's autoattach functionality.

Adding new controllers

A rolling log object is injected into each controller. Access it using req.cache. See the exposed functions here. Each controller should add new objects at ${route}/${uniqueId}. Beware sharing keys between different routes, as IFTTT has a strict 1 route per trigger rule.

Security concerns

In the event that you find a vulnerability, please email [email protected].