Data Processing & Analysisintermediate
November 9, 2025
6 min read
40 minutes
Build an AI Trading Analysis Bot with n8n and Telegram
Turn Telegram into a personal trading analyst. Get real-time stock charts, technical indicators, and AI-powered insights using n8n automation.
By Mahedi Hasan Nadvee

Staring at stock charts for hours, trying to decode candlestick patterns and RSI indicators, only to miss the critical signal buried in the noise. Sound familiar? What if you could just text a bot, ask about any stock, and get professional-grade technical analysis delivered straight to your phone, complete with annotated charts and actionable insights?
That's exactly what this n8n workflow does. It transforms your Telegram into a personal trading analyst that understands voice commands, generates real-time stock charts with technical indicators, and uses GPT-4's vision capabilities to interpret what those squiggly lines actually mean.
What You'll Need to Get Started
Before diving into the workflow magic, let's gather our tools. This setup connects several powerful services, and you'll need accounts and API credentials for each:
Required APIs and Services:
- Telegram Bot Token: Create a bot through BotFather to receive and send messages
- OpenAI API Key: For GPT-4 and GPT-4 Vision model access
- Google Gemini API: To transcribe voice messages into text
- Chart-img.com API Key: Generates TradingView-style stock charts programmatically
- n8n Instance: Either self-hosted or n8n cloud account
Don't let the list intimidate you. Each service offers free tiers or trial periods, and the setup is more straightforward than it looks.
Key Components Under the Hood
This workflow orchestrates 15 different nodes working in harmony. Here's what each major player brings to the table:
- Telegram Trigger: Your workflow's front door, listening for incoming messages
- Switch Node: The traffic controller that routes voice and text differently
- AI Agent: The brain of the operation, powered by GPT-4, deciding when to fetch charts
- Window Buffer Memory: Keeps conversation context so you can ask follow-up questions
- Tool Workflow: A sub-workflow that handles all the chart generation heavy lifting
- HTTP Request Nodes: Communicate with chart generation and file download APIs
- Google Gemini: Converts your voice notes into text the AI can understand
- OpenAI Vision: Actually reads the chart images and extracts technical data
The genius here is modularity. The main workflow handles conversation, while a separate workflow manages chart generation. Clean, maintainable, and easy to extend.
Building Your Trading Bot: The 5-Step Blueprint
Step 1: Set Up the Telegram Gateway
Start by adding a Telegram Trigger node. This creates a webhook that listens for messages sent to your bot. Configure it with your Telegram API credentials and set it to capture message updates. Right after the trigger, add a Switch node that checks whether the incoming message contains voice data or text. This branching logic ensures voice messages get transcribed before hitting the AI agent.
The Switch node evaluates two conditions: whether a voice file ID exists, or whether message text exists. Each path leads to different processing, but both eventually feed into your AI agent.
Step 2: Handle Voice Commands with Transcription
When someone sends a voice message, the workflow needs to convert audio to text. Add a Telegram node set to download the voice file using the file ID from the trigger. This gives you the audio data in binary format.
Next, connect a Google Gemini node configured for audio transcription. Point it to the binary data from the download step, and it returns clean text. This transcribed text then flows into the AI agent, making voice commands just as powerful as typed ones. Imagine asking "Show me Apple stock analysis" while driving, and your bot delivers.
Step 3: Build the AI Agent with Tool Access
This is where personality meets intelligence. Add an AI Agent node and connect an OpenAI Chat Model node (set to GPT-4) as its language model. The system prompt is crucial here. It positions your agent as a professional stock analyst who can discuss markets conversationally but never gives direct buy or sell advice.
The prompt instructs the agent to use the GetChart tool when users request technical analysis. Add a Window Buffer Memory node to give your agent short-term memory, so conversations feel natural and contextual. Someone can ask "What about Microsoft?" right after discussing Apple, and the agent remembers the conversation flow.
Connect a Tool Workflow node that points to your chart generation sub-workflow. Define two input parameters: ticker symbol and chart style. The AI agent automatically extracts these from user messages and passes them to the tool.
image_1.png
Step 4: Create the Chart Generation Sub-Workflow
This sub-workflow is a separate n8n workflow triggered by the tool call. It starts with a Workflow Input Trigger that receives the ticker and chart style parameters.
Add an HTTP Request node that calls the Chart-img.com API. Configure it to POST a JSON payload containing your chart specifications: the stock symbol (formatted as "NASDAQ:TICKER"), chart style (candle, bar, line, etc.), a weekly interval, and three technical studies (Volume, RSI, and Stochastic RSI). The API returns a URL pointing to your freshly generated chart image.
image_2.png
Download that image using another HTTP Request node with the URL from the previous step. Now you have chart image data ready for analysis.
Step 5: Analyze Charts with Vision AI and Respond
Here's where it gets impressive. Add an OpenAI node configured for image analysis using GPT-4 Vision. Feed it the chart image and a detailed prompt asking it to extract specific information: candlestick patterns, exact RSI values, Stochastic RSI K and D line positions, volume trends, and market sentiment.
The prompt is surgical in its specificity. It doesn't just ask for general observations but demands numerical extraction and interpretation. The AI literally reads the chart like a trained analyst would.
Send the chart image back to Telegram using a Telegram node set to send photos. Follow it with another Telegram node that sends the text analysis. The user gets both visual and written insights.
Finally, wire the AI agent's output to a Telegram send node so conversational responses flow back naturally.
image_3.png
Why This Workflow Changes the Game
The real power isn't just automation. It's accessibility. Professional trading platforms cost hundreds monthly and come with steep learning curves. This workflow democratizes technical analysis.
Day traders can quickly scan multiple stocks during market hours without switching apps. The voice command feature means you can request analysis hands-free, perfect for anyone monitoring markets while multitasking.
For learning traders, it's an educational tool. Each analysis explains what the indicators mean and why they matter, turning every chart into a teaching moment. The AI never tells you what to do, but it helps you understand what you're looking at.
Portfolio managers can share the bot with team members, creating a shared analytical resource. Since the workflow maintains conversation context, teams can discuss stocks collaboratively through the same interface.
Beyond trading, the pattern here applies anywhere you need AI to interpret visual data on demand. Replace stocks with satellite imagery, medical scans, or quality control photos, and the same architecture works. You've built more than a trading bot. You've created a template for conversational visual AI systems.
The workflow sits quietly in the cloud, costing pennies per analysis, ready whenever you need it. No subscriptions, no per-seat licenses, just you and your AI analyst having a conversation about markets.
Share this article
Help others discover this content
Tap and hold the link button above to access your device's native sharing options
More in Data Processing & Analysis
Continue exploring workflows in this category

Data Processing & Analysisintermediate
1 min read
# Build an AI-Powered Conversational Survey Bot with n8n: Turn Static Forms into Dynamic Interviews
Nayma Sultana
Nov 15
Est: 40 minutes

Data Processing & Analysisintermediate
1 min read
Build an AI-Powered YouTube Parser with n8n
Mahedi Hasan Nadvee
Nov 13
Est: 45 minutes

Data Processing & Analysisadvanced
1 min read
Build a Smart AI Chatbot That Actually Knows Your Documents (Using n8n RAG Workflow)
Nayma Sultana
Nov 13
Est: 1 hour