Use this advanced n8n workflow to create a Telegram bot that fetches live weather data, processes it into CSV, executes an R script for image generation (ggplot2), and returns the visualization to the user. Leverage the Execute Command n8n node.
Download this n8n workflow template and start using it instantly.
Developers looking for advanced n8n templates integrating external command-line tools (like R or Python).
Data scientists who want to expose complex data visualizations via messaging apps.
Users needing a robust example of custom code scripting within an n8n workflow.
Anyone building a conversational chat bot requiring dynamic image generation.
This sophisticated n8n workflow demonstrates how to extend the core capabilities of n8n by integrating external scripting languages, specifically R, for advanced data processing and visualization. The primary goal is to provide a user-friendly weather report visualized as a ggplot2 chart delivered directly through Telegram. The workflow handles incoming commands via a Telegram n8n trigger, uses the OpenWeatherMap API to gather current weather metrics for several European capitals, formats the data into a CSV file, and then executes a local R script via the Execute Command n8n node to turn that CSV into a dumbbell plot PNG image. This flexible n8n workflow provides robust error handling for both API connection failures and R script execution failures, ensuring a highly functional automation solution.
The n8n workflow starts with the Telegram Trigger n8n node, which listens for incoming messages directed at the configured bot.
Switch n8n node checks the user's message text, acting as the core logic flow control./start, the bot sends a welcoming message (msggreet)./getweather, the bot immediately sends a "Please wait" message (msgpleasewait) and proceeds with the complex data processing pipeline.msgwrongcommand).Set n8n node (Filename) to construct unique, timestamped filenames and necessary filepaths (/home/node/.n8n/weather-bot/). A Function n8n node (City List) provides a hardcoded list of European cities.Get weather data HTTP Request n8n node fetches real-time temperature data from the OpenWeatherMap API. An If n8n node (Any errors API?) immediately checks for connection failures or bad API responses, redirecting to msgerrorAPI if necessary.Convert API response Function n8n node. The Spreadsheet File n8n node formats this data into a binary CSV object, which is then saved to the local file system using the Write csv n8n node.Run R script Execute Command n8n node is executed. It calls the external R script, passing the generated CSV file path as the input argument and the desired PNG output path.If n8n node (R successful?) checks the exit code of the R script. If the code is 0, the Read Binary File n8n node retrieves the newly created PNG image, and the msggetweather Telegram n8n node sends the visualization back to the user. If the R script fails, an error notification (msgerrorR) is sent instead.Get weather data HTTP Request n8n node with your valid OpenWeatherMap API key.Execute Command n8n node.ggplot2) installed and accessible./home/node/.n8n/weather-bot/) within your n8n volume.dumbbell_plot.R, referenced in the JSON) and place it within the target folder.Telegram Trigger n8n trigger to active to start processing incoming messages. Telegram Trigger: Function: Initiates the n8n workflow upon receiving any message in the linked Telegram bot.
Switch: Function: Provides essential core logic flow control, routing the flow based on the command received (e.g., /getweather).
Set (Filename): Function: Dynamically generates file names and folder paths, which are crucial for the Execute Command n8n node and file operations.
Function (City List / Convert API response): Function: Defines the city list for the API calls and transforms the raw JSON response into a normalized data structure suitable for CSV creation.
HTTP Request (Get weather data): Function: Calls the external OpenWeatherMap API to retrieve real-time weather data.
Spreadsheet File: Function: Converts the structured data into a CSV binary file format, preparing it for the external R script.
Write Binary File (Write csv): Function: Saves the CSV binary data to the local disk, making it accessible for the external R processing command.
Execute Command (Run R script): Function: The key custom code scripting element. Executes an external command-line process (Rscript) to generate a PNG image visualization based on the input CSV file.
If (R successful?): Function: Checks the exit code of the command execution to ensure the R script ran without errors before attempting to read the output image. This provides robust error handling to the n8n workflow.
Telegram (msg_getweather): Function: Uses binary data to send the final, generated PNG image back to the user.
Use this robust n8n workflow to automate extending short UGC videos using Fal AI and Kling 2.1 (Runpod), merging clips, and publishing the final video across all major social media platforms.

Expose the eBay Translation API as a callable tool for any AI Agent using this specialized n8n workflow. Integrate LLMs with powerful e-commerce functionality using n8n templates.

Use this powerful n8n workflow template to expose the eBay Taxonomy API to your AI agents, enabling dynamic product categorization and aspect retrieval using the specialized n8n node structure.

Automate Amazon review analysis using this powerful n8n workflow. Scrape negative feedback, analyze sentiment and improvement suggestions with Gemini AI, and save data to Google Sheets.

Use this powerful n8n workflow to combine Bright Data web scraping with Google Gemini AI for advanced brand content analysis, summarization, and structured sentiment analysis. Easily extract insights using this n8n template.

Use this powerful n8n workflow to automate competitor backlink extraction utilizing Bright Data MCP, AI agents, and GPT-4o-mini. Analyze link data and automatically store results in Google Sheets. Find more advanced n8n templates here.








































