AQI Bot fetches air quality and posts that data to slack. This repo consists of two component which operate separately. A stand alone job to fetch and send air data, and a web server to make requests on demand. The project makes use of the air visual api https://www.airvisual.com/air-pollution-data-api
Located in the job folder, consists of a main.go file to run the job and a Dockerfile to build and run as a docker image. When run, the job fetches the aqi and posts it to the configured channel. The job should be set up to run on a cron schedule to periodically post air quality data to slack.
Required:
SLACK_WEBHOOKwebhook url to post data to slackSLACK_CHANNELthe channel to post the data toAIRVISUAL_API_KEYthe api key for air visual
Located in the server folder, it consists of a main.go file and a Dockerfile to build the job. The web server binds to port 8080, and listens for POST requests on / from slack. It will verify the requests came from slack, fetch air quality data, and return the response to post in slack. It is meant to be installed as a slash command in slack.
Valid options to the base slash command include:
city "<City>" "<State>" "<Country>"which will return data for the specified citynycfor New York CityLAfor Los Angelescigarettesto calculate the number of cigarettes spending all day in the air with aqi is equal to
The default returned values are for San Francisco, California, USA.
Required:
AIRVISUAL_API_KEYthe api key for air visualSLACK_SIGNING_SECRETthe secret with which slack responses will be signed