Automated Weather Reports via Telegram Bot
detail.loadingPreview
This workflow automates the delivery of visually appealing weather reports directly to your Telegram. Interact with a bot to request weather data for European capitals, presented as an image generated with R's ggplot2.
About This Workflow
This n8n workflow empowers you to build a sophisticated Telegram bot capable of fetching and delivering real-time weather data. Upon receiving a command, the bot queries an external API for weather information across several European cities. It then processes this data, generating a unique image visualization using R's powerful ggplot2 library. The resulting image, along with a personalized greeting and status message, is sent back to the user via Telegram. The workflow handles command parsing, API integration, data transformation, and image generation, offering a seamless and automated weather reporting experience.
This solution is ideal for anyone looking to integrate external data with interactive messaging platforms, demonstrating a practical application of API calls, function nodes for data manipulation, and external scripting for advanced visualization.
Key Features
- Interactive Telegram Bot: Engage with a user-friendly Telegram bot to request weather data.
- Automated Data Fetching: Seamlessly retrieves real-time weather information from an external API.
- Customizable City List: Easily manage and expand the list of European cities for which weather data can be requested.
- R-Generated Visualizations: Receives weather data as a professional, ggplot2-created image.
- Error Handling: Robust error management ensures graceful responses for API failures or unrecognized commands.
How To Use
- Set up Telegram Trigger: Configure the
Telegram Triggernode with your bot's API token to listen for incoming messages. - Command Routing: Utilize the
Switchnode to direct incoming Telegram messages based on commands like/startor/getweather. - Greet User: Connect the
/startcommand output to themsg_greetnode to send a welcome message explaining the bot's capabilities. - Define Cities: Use the
City Listfunction node to create an array of European cities with their IDs, names, and countries. - Fetch Weather Data: For the
/getweathercommand, use theGet weather dataHTTP Request node. Dynamically inject theCityidfrom theCity Listinto the API URL. - Handle API Errors: Employ the
Any errors API?If node to check for errors from the weather API. If an error occurs, route tomsg_errorAPI. - Process API Response: If the API call is successful, use the
Convert API responsefunction node to format the data for the R script. - Generate Image File: The
Spreadsheet Filenode is used to convert the processed data into a CSV format, andWrite csvsaves it to a binary file. (Note: The provided JSON implies an R script is executed externally to generate the image, which is linked in theConvert API responsenode's code. Ensure your setup includes an R environment capable of running the linked script). - Send Weather Image: Connect the output of the image generation process to the
msg_getweatherTelegram node to send the weather image to the user. - Handle Wrong Commands: If a command is not recognized by the
Switchnode, route to themsg_wrongcommandnode for user feedback.
Apps Used
Workflow JSON
{
"id": "012dcd8d-f91d-4bf8-8aeb-dcf22f6e509a",
"name": "Automated Weather Reports via Telegram Bot",
"nodes": 18,
"category": "Marketing",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 012dcd8d-f91d...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Automated Multi-Platform Social Media Publisher
Streamline your social media content creation and publishing with this n8n workflow. Simply fill out a web form with your caption, media (image or video), and target platforms, and let n8n automate the posting process across multiple social networks.
WhatsApp AI Assistant: LLaMA 4 & Google Search for Real-Time Insights
Instantly deploy a smart AI assistant on WhatsApp, powered by Groq's lightning-fast LLaMA 4 model. This workflow enables real-time conversations, remembers context, and provides up-to-date answers by integrating live Google Search results.
AI-Powered On-Page SEO Audit & Report Automation
Instantly generate comprehensive on-page SEO technical and content audits for any website URL. This AI-powered workflow automates the entire process, from scraping the page to delivering a detailed report directly to your inbox, empowering you to optimize for better search rankings and user engagement.