A Val Town email trigger that filters DC Water emergency alerts by proximity to your home address. Only alerts within a configurable radius in the NE quadrant are forwarded to your inbox.
The filter is intentionally fail-open: if location parsing or geocoding fails, the email is forwarded with a note about what went wrong. The only hard filter is the NE quadrant check.
backend/
index.ts # Val Town email trigger entry point
shared/
parsing.ts # Location extraction, parsing, geocoding, distance calc
parsing_test.ts # Deno tests
examples/
*.eml # Sample DC Water alert emails for testing
Set these in your Val Town environment:
| Variable | Required | Description |
|---|---|---|
HOME_LAT | Yes | Your home latitude |
HOME_LNG | Yes | Your home longitude |
ALLOWED_SENDER | No | Only process emails from this address (sender filter) |
The proximity radius is set to 1.0 miles in backend/index.ts.
deno test shared/parsing_test.ts --allow-read --allow-net --no-config
--no-config is needed to avoid deno.json pulling in Val Town types that
aren't available locally.
located on/in [LOCATION]. Some customers found in DC Water alert templates