This project is a WhatsApp bot built using Python and the OpenWeather API to fetch daily weather updates. The bot sends weather information to a list of WhatsApp contacts through the UltraMsg API, ensuring users are prepared for the day's weather before heading out.
- Fetches weather data from the OpenWeather API.
- Sends automated daily weather updates via WhatsApp using UltraMsg API.
- Customizable to send messages to any number of contacts.
- Easy to configure and run as a daily cron job.
- Python: Main programming language.
- OpenWeather API: For retrieving weather data.
- UltraMsg API: For sending WhatsApp messages.
- Python 3.x: Make sure Python is installed. You can download it from here.
- OpenWeather API Key: Sign up at OpenWeather and get your API key.
- UltraMsg Account: Sign up at UltraMsg and get your API credentials.
-
Clone the repository:
git clone https://github.com/uditbhatia26/weather-updates-whatsapp.git cd weather-updates-whatsapp
-
Set up your environment variables or API credentials:
- Create a
.env
file or directly add your OpenWeather API key, UltraMsg API key, and contact numbers to the script.
- Create a
-
Configure the script to fetch weather data for your location.
-
Run the bot to send weather updates:
python main.py
- The bot fetches the weather data from the OpenWeather API.
- Weather information is formatted and sent to the specified WhatsApp numbers using UltraMsg API.
- You can modify the timing of the weather update by scheduling the script with cron jobs.
The bot sends messages like:
Good morning! ☀️
Here’s your weather update for today:
Temperature: 25°C
Conditions: Clear sky 🌤️
Humidity: 60%
Wind Speed: 10 km/h 🌬️
Stay prepared before heading to college!
- Update the list of WhatsApp numbers in the script to add more recipients.
- Add multiple location support.
- Implement weather alerts for extreme conditions.