A simple Telegram bot written in Java that provides current weather information based on a city name using geocoding and weather APIs.
- Get current weather by city name
- Uses geocoding to convert city → coordinates
- Fetches weather data from Open-Meteo API
- Handles invalid input gracefully
- Async processing (non-blocking bot response)
- Basic error handling for API and parsing issues
- Java 17+
- Telegram Bots API
- Jackson (JSON parsing)
- Java HttpClient
- Open-Meteo Geocoding API
- Open-Meteo Weather API
- User sends a city name to the bot
- Bot sends request to Geocoding API
- City is converted into latitude/longitude
- Coordinates are passed to Weather API
- Bot returns current weather info
GeocodingApiClient– handles city → coordinates conversionWeatherApiClient– fetches weather data by coordinatesCoordinates– simple DTO for latitude/longitudeWeatherResponse / CurrentWeather– JSON mapping modelsMyTelegramBot– message handling and user interaction
🌥️Weather in London right now:
Temperature: 27.9°C
Wind Speed: 16.9 km/h
🌡️It's Hot Outside