Personal Weather Forecast

tl;dr Personal Weather Forecast iswas a small JavaScript program that mashes together Dark Sky’s API with Twilio’s APIs to produce a personally tailored weather forecast and sends it to you as a text message every morning. The source code is available as a project on GitHub, here.

A demonstration of the sort of output the bot generated

If you want to receive your own personal weather forecast every morning…

#!/bin/sh

export DARKSKY_KEY=[your-darksky-key]
export DARKSKY_LATLONG=[the-location-for-the-forecast]
export TWILIO_ACCOUNT=[your-twilio-account-sid]
export TWILIO_TOKEN=[your-twilio-auth-token]
export TWILIO_FROM=[your-twilio-phone-number]
export TWILIO_TO=[your-destination-phone-number]

pushd /[repo-location]/personal-weather-forecast >/dev/null
node main.js
popd >/dev/null

To make it run every morning, you should edit your user’s crontab which with the following command…

$ crontab -e

…and add the following line…

0 7 * * 1-5 ~/bin/forecast-sms

…which references the location of the previously saved script. This cron entry means that every Monday to Friday morning at 7am you’ll receive your very own personal weather forecast!

A full weather forecast giving a summary text for the day and an hour by hour temperature and condition forecast

2018-12-29

Leave a comment