Building wayfarer
I’ve built a small utility which checks whether your commute will be longer than usual, and sends you a message to warn you if it is.
I run it on my own server, but it’s available for wider use as a binary and as a Docker image. The code is available on GitHub in a repository called wayfarer.
How it works
The user defines the origin and destination of their commute as well as the possible start times in a config.yaml file.
The utility checks the expected commute duration for each start time using the Google Maps API.
If it exceeds a user-specified threshold, a message is sent to the user on Telegram.
The user-supplied config looks like this:
rules:
- id: 1
origin:
name: 10 Downing Street
longitude: -0.1276
latitude: 51.503
destination:
name: Palace of Westminster
longitude: -0.1246
latitude: 51.498
user:
telegram_user_id: your_telegram_user_id
travel_time:
notification_threshold_minutes: 8
times:
- day: MONDAY
time: 09:00
- day: TUESDAY
time: 09:00
- day: WEDNESDAY
time: 09:00
- day: THURSDAY
time: 09:00
- day: FRIDAY
time: 09:00
timezone: Europe/London
Here’s how the received message looks in Telegram:

Reflections
This was my first go project. I initially built it in Java, however I found that I wanted something with a smaller memory footprint. I’ve written unit tests for the main logic, plus an integration test which mocks out the Google and Telegram APIs. With these tests, I feel confident enough to automatically merge dependency bumps.
The Telegram bot API is very easy to use, especially getting started from scratch. I anticipate using it in future projects.