This project is a simple Telegram bot that provides weather information. Users can send the name of a city to receive its current weather details. The bot uses WeatherAPI to fetch weather data.
- Get weather information for any city
- Displays:
- Current Temperature
- Weather Condition
- Humidity
- Wind Speed
- Integrates with Telegram using the
node-telegram-bot-api
library - Powered by the reliable WeatherAPI
- Node.js v12 or higher
npm
(Node.js package manager) installed- A Telegram bot token (generated via BotFather)
- A WeatherAPI key (sign up at WeatherAPI)
-
Clone the repository
git clone https://github.com/Edrisss154/WeatherAPI.git cd WeatherAPI
-
Install dependencies
npm install
-
Edit the project file
- Open
index.js
:- Replace
TELEGRAM_TOKEN
with your Telegram bot token - Replace
WEATHER_API_KEY
with your WeatherAPI key
- Replace
- Open
-
Run the bot
node index.js
- Open Telegram and message your bot.
- For example, if you send "Tehran," the bot will display the current weather for Tehran.
- node-telegram-bot-api: To interact with the Telegram API
- axios: To make HTTP requests to WeatherAPI
Weather in Tehran:
- Temperature: 22°C
- Condition: Clear
- Humidity: 60%
- Wind Speed: 15 km/h
- Email: edrisss14@gmail.com
- GitHub: Edrisss154