# Rain in the next hour: an alert for your city

A bot or widget that warns when rain is coming soon, from free weather-service forecasts and radar.

## Parts

- Data: [MET Norway Weather API](https://agentgid.com/resources/met-norway-locationforecast/agent.md): The free forecast API behind Yr: give it a latitude and longitude anywhere in the world and get a point forecast (temperature, wind, rain, cloud, UV, weather symbol) as JSON or legacy XML.
- Data: [Open-Meteo](https://agentgid.com/resources/open-meteo/agent.md): A JSON weather API that serves forecasts from 30+ national weather models plus hourly historical weather back to 1940, with sister APIs for air quality, marine, flood, elevation and geocoding.
- Data: [RainViewer Weather Maps API](https://agentgid.com/resources/rainviewer-api/agent.md): A free public JSON index plus PNG map tiles of a global weather-radar composite built from 1200+ radars, covering the past 2 hours with nowcast frames, ready to drop on a Leaflet or MapLibre map.
- Product recipe: [Telegram AI bot](https://agentgid.com/build/recipes/telegram-ai-bot/agent.md)
- Check on a schedule: [APScheduler](https://agentgid.com/tools/apscheduler/agent.md)
- Radar map: [Leaflet](https://agentgid.com/tools/leaflet/agent.md)

## Steps

1. Ask MET Norway's Locationforecast for each follower's coordinates (rounded to 4 decimals) and cache it until the Expires header says to refresh.
2. When the next hours show precipitation above your threshold, send one alert per rain spell, not one per check.
3. Add a radar map with RainViewer tiles for a quick look.

## Watch out

- For a commercial app use MET Norway (commercial use allowed with credit) or a paid Open-Meteo plan; the free Open-Meteo API is non-commercial only, ads or subscriptions included.
- Send an identifying User-Agent to MET Norway, credit "MET Norway", and show "Weather data by RainViewer" next to the radar; RainViewer's free use is for personal, educational and small community projects.

Human page: https://agentgid.com/resources/ideas/rain-alert-for-your-city/
