How to build a Telegram weather bot for any city

By the Botable team

A Telegram weather bot returns current conditions and a forecast for a city name or a shared location pin. Describe the format you want — temperature, wind, rain chance — and Botable builds the bot, wires the weather API, and hosts it.

What is a weather bot?

A Telegram weather bot converts a place into a forecast inside a chat. Two inputs matter: a typed city name, which needs geocoding to become coordinates, and Telegram's native location share, which arrives as coordinates already and is the more reliable of the two. Once you have coordinates, a weather API returns current conditions plus a forecast, and the bot's real job is formatting — a wall of numbers is useless on a phone, while three lines with a temperature, a rain probability and a wind speed is read at a glance. The feature that turns a weather bot into a habit is the scheduled briefing: a saved home city plus a daily message at a chosen hour. That requires storing one row per user, which on Botable is handled by the SQLite database created with the bot.

What commands does it have?

Commands a weather bot typically has, and what each one does
CommandWhat it does
/weather londonCurrent conditions for a named city
/forecastMulti-day outlook for the saved home city
/setcity berlinSaves a home city for later commands
/daily 08:00Schedules a morning briefing at that time
Share locationWeather for exactly where the user is

What do you need before you start?

  • A Telegram bot token from @BotFather
  • A weather data source — free tiers of the common providers are sufficient
  • A decision on units: Celsius or Fahrenheit, or per-user choice

How do you build it?

Should users type a city or share a location?

Support both, but treat the shared location as the primary path. It skips geocoding entirely and cannot be misspelled. Typed city names need disambiguation — there are dozens of Springfields — so ask for a confirmation step when a name is ambiguous.

How much forecast detail belongs in one message?

Three or four facts. Temperature, what it feels like, chance of rain, wind. Anything more and the message stops being scannable. Put the longer outlook behind a separate command so the common case stays short.

How do daily briefings get scheduled?

The bot stores each user's home city and preferred hour, and a scheduled job sends the message. Say the timezone rule you want — the user's own timezone is the natural choice but has to be asked for, since Telegram does not supply it.

Can it warn about severe weather?

If your weather source exposes alerts, yes. Describe the threshold that should trigger a push — a storm warning, or rain above a percentage — so the bot is not messaging people about ordinary drizzle.

A prompt you can use as-is

Paste this into Botable and adjust the details. It is specific on purpose — a vague description produces a vague bot.

Build a weather bot. /weather <city> returns current conditions: temperature, feels-like, chance of rain and wind, in Celsius. Accept a shared Telegram location and use it directly instead of geocoding. /setcity saves a home city and /forecast shows a 5-day outlook for it. /daily <time> sends a morning briefing at that hour in the user's timezone, which the bot should ask for once.

Build this bot

Who is this bot for?

  • Anyone who checks the weather every morning and wants it pushed instead
  • Outdoor businesses — delivery, events, sports groups — briefing a team daily
  • Travel groups sharing conditions for a destination

What goes wrong with this kind of bot?

  • Ambiguous city names are the top source of wrong answers; confirm rather than guess
  • Weather APIs cache heavily — a bot that refreshes every minute burns quota for nothing
  • Scheduled briefings need the user's timezone, which has to be collected explicitly

Questions about weather bots

Can it post the forecast to a group every morning?

Yes. Add the bot to the group and ask for the scheduled message to go to the group chat rather than to individuals, with one city for the whole group.

Which weather provider is used?

Whichever you name. If you do not name one, a free public source is used. The call is made server-side, so no API key ends up in a chat.

All twelve build guides