Reply in Telegram with the current conditions for whatever place someone names in the chat.

UsesOpenWeatherMapTelegram

Look up the weather from Telegram

Whenever a message in your Telegram chat starts with your chosen keyword followed by a place name, the current conditions there are looked up and the reply comes back in the same chat: conditions, temperature and what it feels like, humidity and wind. Multi-word places work, and so does a postal code or a name with a country code when the plain name is ambiguous.

The reply reports the readings that came back and nothing more. It does not warn about severe weather, because a current reading is not a warning, and any reading the service does not return is left out rather than shown as zero. A place that cannot be found gets a reply saying so, with a hint about adding a country code. Messages that do not start with the keyword are ignored, so the bot stays quiet in a busy group.

You need a Telegram bot in the chat and a keyword for it to listen for, and temperatures come back in the units you choose.

TelegramTelegramWhen a new message is received. Save it as message.When a new message is received. Save it as message.
ValuesSet weatherKeyword to blank.Set weatherKeyword to blank.
ValuesSet units to metric.Set units to metric.
ValuesSet chatId to message.chat_id.Set chatId to message.chat_id.
ValuesSet messageText to blank.Set messageText to blank.
Decisions & LoopsIf a step below fails, save the error as noTextErrorIf a step below fails, save the error as noTextError
Try
TextTrim message.text and save it as messageText.Trim message.text and save it as messageText.
On error
ValuesShow in the output: This message carried no text, so there was nothing to look up..Show in the output: This message carried no text, so there was nothing to look up..
Decisions & LoopsIf messageText is emptyIf messageText is empty
Yes
Decisions & LoopsFinish the run: This message carried no text, so no weather was looked up.Finish the run: This message carried no text, so no weather was looked up.
No
No steps
TextSplit messageText by a space and save it as words.Split messageText by a space and save it as words.
TextMake words[0] lowercase and save it as commandWord.Make words[0] lowercase and save it as commandWord.
Decisions & LoopsIf commandWord is not weatherKeyword in lowercaseIf commandWord is not weatherKeyword in lowercase
Yes
Decisions & LoopsFinish the run: This message was not a weather request, so nothing was looked up.Finish the run: This message was not a weather request, so nothing was looked up.
No
No steps
TextTrim the items from index 1 onward of words joined by a space and save it as place.Trim the items from index 1 onward of words joined by a space and save it as place.
Decisions & LoopsIf place is empty or the length of place is greater than 60If place is empty or the length of place is greater than 60
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.Send a place after '@weatherKeyword', for example: weatherKeyword London
Decisions & LoopsFinish the run: No usable place name was in the message.Finish the run: No usable place name was in the message.
No
No steps
ValuesSet weather to nothing.Set weather to nothing.
ValuesSet lookupFailed to false.Set lookupFailed to false.
Decisions & LoopsIf a step below fails, save the error as weatherErrorIf a step below fails, save the error as weatherError
Try
OpenWeatherMapOpenWeatherMapGet the current weather. Save it as weather.Get the current weather. Save it as weather.
On error
ValuesChange lookupFailed to true.Change lookupFailed to true.
Decisions & LoopsIf lookupFailed is yesIf lookupFailed is yes
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.I could not look up the weather for place. Try adding a country code, like London,GB, or a postal code.
Decisions & LoopsFinish the run: No weather was found for place.Finish the run: No weather was found for place.
No
No steps
ValuesSet temperatureUnit to K.Set temperatureUnit to K.
ValuesSet windUnit to m/s.Set windUnit to m/s.
Decisions & LoopsIf weather.units is metricIf weather.units is metric
Yes
ValuesChange temperatureUnit to °C.Change temperatureUnit to °C.
No
No steps
Decisions & LoopsIf weather.units is imperialIf weather.units is imperial
Yes
ValuesChange temperatureUnit to °F.Change temperatureUnit to °F.
ValuesChange windUnit to mph.Change windUnit to mph.
No
No steps
ValuesSet replyLines to an empty list.Set replyLines to an empty list.
ValuesSet heading to place.Set heading to place.
Decisions & LoopsIf weather.location isn't emptyIf weather.location isn't empty
Yes
ValuesChange heading to weather.location.Change heading to weather.location.
No
No steps
Decisions & LoopsIf weather.country isn't emptyIf weather.country isn't empty
Yes
ValuesChange heading to heading, weather.country.Change heading to heading, weather.country.
No
No steps
ListsAdd heading to the end of replyLines and save it as replyLines.Add heading to the end of replyLines and save it as replyLines.
Decisions & LoopsIf weather.conditions isn't emptyIf weather.conditions isn't empty
Yes
ListsAdd Conditions: weather.conditions to the end of replyLines and save it as replyLines.Add Conditions: weather.conditions to the end of replyLines and save it as replyLines.
No
No steps
Decisions & LoopsIf weather.temperature isn't emptyIf weather.temperature isn't empty
Yes
ListsAdd Temperature: weather.temperature formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.Add Temperature: weather.temperature formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.
No
No steps
Decisions & LoopsIf weather.feels_like isn't emptyIf weather.feels_like isn't empty
Yes
ListsAdd Feels like: weather.feels_like formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.Add Feels like: weather.feels_like formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.
No
No steps
Decisions & LoopsIf weather.humidity isn't emptyIf weather.humidity isn't empty
Yes
ListsAdd Humidity: weather.humidity formatted as a plain number with 0 decimal places% to the end of replyLines and save it as replyLines.Add Humidity: weather.humidity formatted as a plain number with 0 decimal places% to the end of replyLines and save it as replyLines.
No
No steps
Decisions & LoopsIf weather.wind_speed isn't emptyIf weather.wind_speed isn't empty
Yes
ListsAdd Wind: weather.wind_speed formatted as a plain number with 1 decimal place@windUnit to the end of replyLines and save it as replyLines.Add Wind: weather.wind_speed formatted as a plain number with 1 decimal place@windUnit to the end of replyLines and save it as replyLines.
No
No steps
ListsAdd Current conditions reported by OpenWeatherMap. to the end of replyLines and save it as replyLines.Add Current conditions reported by OpenWeatherMap. to the end of replyLines and save it as replyLines.
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.replyLines joined by a new line