Interactive Telegram Weather Bot with R & ggplot2
detail.loadingPreview
Build a sophisticated Telegram bot that delivers dynamic weather information for European capitals. This workflow integrates OpenWeatherMap API data with custom R scripting and ggplot2 for stunning, personalized data visualizations directly within your chat.
About This Workflow
Unlock the power of conversational AI and data visualization with this n8n workflow. It enables you to create an intelligent Telegram bot that responds to user commands, fetches real-time weather data for a curated list of European cities, and processes this information using custom JavaScript functions. The true highlight is its integration with the R programming language and its ggplot2 package, allowing for the generation of visually rich weather charts sent directly back to the user as an image. This bot handles various commands and includes robust error handling for API failures or issues during image generation, ensuring a smooth user experience.
Key Features
- Telegram Chat Interface: Interact with users directly through a familiar Telegram bot.
- Dynamic Weather Data: Fetches real-time weather details for multiple European cities using the OpenWeatherMap API.
- Custom Data Transformation: Processes API responses and prepares data for visualization using n8n's Function nodes.
- Advanced R & ggplot2 Integration: Leverages external R scripts and the powerful
ggplot2package to generate custom weather charts as images. - Intelligent Command Handling: Uses a Switch node to route user commands like
/startand/getweatherto appropriate responses. - Robust Error Management: Provides user-friendly error messages for failed API calls or issues during image creation.
How To Use
- Configure Telegram Credentials: Set up your Telegram Bot API token in the
Telegram Triggernode and allTelegramnodes. - Add OpenWeatherMap API Key: Input your OpenWeatherMap
appidinto theGet weather dataHTTP Request node's URL parameter. - Prepare Local File System: Create the
/home/node/.n8n/weather-bot/directory on your n8n host, as specified in theFilenamenode, to store temporary data and generated images. - Integrate R Script: Ensure you have an R script (as mentioned in the
Convert API responsenode's notes) that reads a CSV file (generated byWrite csv), processes it, generates aggplot2image, and saves it into the designated folder. An 'Execute Command' node (not shown in snippet) would be needed here to run this script. - Run and Test: Activate your workflow and send
/startor/getweathercommands to your Telegram bot to test its functionality and receive your first visual weather report.
Apps Used
Workflow JSON
{
"id": "423eaea4-fe51-4e12-b13e-60f619927c04",
"name": "Interactive Telegram Weather Bot with R & ggplot2",
"nodes": 17,
"category": "Personal",
"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: 423eaea4-fe51...
About the Author
AI_Workflow_Bot
LLM Specialist
Building complex chains with OpenAI, Claude, and LangChain.
Statistics
Related Workflows
Discover more workflows you might like
Smart Expense Tracking with Telegram & AI
Automate your personal finance management by turning your Telegram chat into an intelligent expense tracker. Simply send a photo of a receipt or a text message, and this workflow uses AI to categorize your spending, extract crucial details, and provide instant summaries.
Send Obsidian Notes as Emails with Dynamic Attachments
This workflow empowers you to transform your Obsidian notes into dynamic emails, complete with custom metadata from YAML frontmatter and automated attachment handling. Seamlessly share your thoughts and files directly from your preferred note-taking environment.
AI Music Generator with Suno V3.5 (KIE.ai)
This n8n workflow automates AI music generation using the KIE.ai API, powered by the Suno V3.5 model. Users simply submit music prompts, styles, and titles via a web form, and the system handles real-time generation and delivery of the final audio output. It's perfect for quickly creating custom music for various needs.