Do you want an automated way to analyze stocks by sending a simple text message? Imagine texting a ticker symbol like “AAPL” to a Telegram bot and getting a chart with a plain-English trend summary in seconds. You can build this stock analysis AI agent with n8n, OpenAI, Telegram, TwelveData, and Chart IMG without writing code.
Quick Answer
You can build a custom stock analysis bot by using n8n to connect Telegram, OpenAI, TwelveData, and Chart IMG. After setup, you send a ticker symbol to Telegram and receive a chart plus an AI-powered technical summary. This project can be completed with visual workflow tools, not custom code.
Key Takeaways
- n8n acts as the automation engine that connects Telegram, market data, charting, and AI analysis.
- Telegram is the user interface, so you can request analysis from your phone.
- TwelveData supplies stock market data, while Chart IMG converts that data into a visual chart.
- OpenAI turns the technical data into a readable summary that is easier to understand.
- This bot is useful for research and learning, but it should not replace professional financial advice.
At a Glance
| Time Required | About 45–90 minutes once your accounts and API keys are ready. |
| Difficulty | Beginner to intermediate. You need to copy API keys, import a workflow, and test each node. |
| Tools Needed | n8n, Telegram, OpenAI API access, TwelveData, Chart IMG, and a hosting option for n8n. |
| Cost | Costs depend on your hosting plan and API usage. Some services may offer free tiers, but limits can apply. |
Setting Up the n8n Automation Platform
n8n is an automation platform that connects different apps and services in one visual workflow. For this stock analysis bot, n8n works as the central engine. It receives your Telegram message, sends the ticker request to market and charting tools, passes the results to OpenAI, and returns the final response to Telegram.
You need a working n8n instance before you can build the workflow. You can host it locally, use a third-party server, or choose n8n Cloud. The right option depends on your budget, uptime needs, and comfort level with server management.
Hosting Options for n8n
You have three primary ways to host your n8n instance:
- Local Hosting: You run n8n on your own computer. This is a low-cost option, but your machine must stay active for the bot to work.
- WebSpaceKit (WSK) Hosting: This provides a cloud environment that can keep your bot running without leaving your personal computer online all day.
- n8n Cloud: This is the official hosted option from n8n. It can be easier to maintain, though the cost may be higher than some self-hosted setups.
This guide uses WebSpaceKit because it gives you a practical balance between uptime and ease of setup. You can still follow the same workflow logic if you choose another hosting option.
Note: If you host n8n on your own computer, the Telegram bot may stop responding when your computer shuts down, sleeps, loses internet access, or the n8n process stops running.
Purchasing and Installing n8n
Follow these steps to prepare your environment:
- Visit the WebSpaceKit website and select a hosting plan that fits your budget and expected workflow usage.
- Complete the checkout process to activate your hosting account.
- Navigate to your dashboard and click “Go to Setup” to configure your n8n instance.
- Confirm that your n8n dashboard opens correctly before you import the workflow template.
Once the dashboard loads, you are ready to import the workflow. At this point, keep your hosting dashboard open because you may need it while testing and activating the automation.
Importing the Workflow Template
You can save time by importing a pre-built workflow template instead of creating every node from scratch. A template is helpful because it gives you the complete structure first, then you only need to connect credentials and adjust settings.
- Download the “Technical Analysis Agent” template in .json format from the WSK templates page.
- In your n8n dashboard, select “Start from Scratch” and choose “Import from File.”
- Upload your .json file and name the workflow “Stock Analysis Bot.”
- Open the imported workflow and scan each node for warning icons or missing credentials.
You will see warning icons on some nodes after importing the workflow. These icons usually mean n8n needs credentials, API keys, or required fields before the workflow can run.
Configuring Essential Workflow Nodes
The workflow requires connections to four external services. Each service has a specific role in the stock analysis process, and each one needs valid credentials before n8n can communicate with it securely.
- Telegram: Receives your stock symbol request and sends the final response back to you.
- OpenAI: Converts market and chart data into a readable explanation.
- TwelveData: Provides stock pricing and market information.
- Chart IMG: Generates a visual stock chart from the requested data.
Connecting Telegram
Telegram acts as the front end of your stock analysis bot. Instead of opening multiple tools, you send a message to your bot and let n8n handle the workflow in the background.
- Message @BotFather on Telegram to create a new bot.
- Send the
/newbotcommand and follow the instructions to name your bot. - Copy the API token provided by BotFather.
- In n8n, open the Telegram trigger node, paste your API token, and activate it.
- Send a test message to confirm that n8n can detect incoming Telegram updates.
Warning: Treat your Telegram bot token like a password. Do not publish it in screenshots, public templates, shared documents, or website code.
Send a test message to your new bot. The output in n8n will show your chat ID. Save this ID if your workflow uses a fixed recipient. You will need it to make sure the bot replies to the right Telegram conversation.
Connecting OpenAI
OpenAI processes your request and provides the plain-English stock breakdown. In this workflow, OpenAI should not be treated as a financial advisor. Its role is to summarize data, explain patterns, and make technical information easier to read.
- Generate an API key in your OpenAI account settings.
- Open the OpenAI node in n8n and select “Create Credentials.”
- Paste your API key and save the connection.
- Test the node with a sample prompt to confirm that n8n can send and receive a response.
A strong OpenAI prompt should tell the model what to analyze and what not to do. For example, you can ask it to summarize trend direction, support and resistance, volume behavior, and risk factors while avoiding direct buy or sell instructions.
Pro Tip: Add clear limits to your AI prompt, such as “use educational language,” “avoid financial advice,” and “mention that users should verify data before trading.” This makes the response safer and more useful.
Enabling Stock Data and Charting
Your workflow uses TwelveData for market information and Chart IMG for visual output. These services help the bot move beyond a basic text response. Instead of only explaining a ticker, the bot can include price context and a chart image that gives the analysis more structure.
Connecting TwelveData
TwelveData provides market data such as pricing, symbols, exchange information, and time-series data. In this workflow, n8n uses that data to understand the requested stock and prepare information for charting and analysis.
- Create an account on the TwelveData website.
- Locate your API key in the account dashboard.
- Add or open the HTTP Request node in n8n that connects to the TwelveData API.
- Paste the API key in the correct authentication field or request parameter, depending on how your workflow template is built.
- Run the node with a sample ticker, such as AAPL or TSLA, to confirm that the response returns usable market data.
Always consult a qualified professional before making financial decisions. Data availability, exchange coverage, and latency can vary by provider plan, symbol, exchange, and region. Free plans may also have rate limits or restrictions on some international and low-volume symbols.
Connecting Chart IMG
Chart IMG turns your price data into a visual chart. This gives your Telegram response a faster visual summary, especially when you want to check trend direction, recent price action, or a selected timeframe.
- Generate an API key on the Chart IMG website.
- Add or open the HTTP Request node in your n8n workflow.
- Configure the node to send your API key in the request header.
- Set the required chart parameters, such as symbol, interval, and chart style.
- Test the request and confirm that the node returns an image or image URL that Telegram can send.
Specify your desired interval, such as 1D for one-day charts, so the visual output matches your analysis goal. You can also experiment with other intervals if your workflow and data provider support them.
Managing Multi-User Access
If you plan to share this bot with more than one person, avoid using one hardcoded chat ID for every response. A fixed chat ID can send replies to the wrong person or limit the bot to one Telegram account.
Instead, use dynamic expressions to handle responses. Replace the hardcoded chat ID in your “Send Chat” node with {{$json["message"]["chat"]["id"]}}. This expression reads the chat ID from each incoming message and helps the bot reply to the specific person who made the request.
Note: For private use, a hardcoded chat ID may be fine. For shared use, dynamic chat routing is safer and more flexible.
Testing and Refining Your Bot
Once your credentials are connected, set your workflow to “Active.” Send a request like “Analyze Tesla” or “Analyze AAPL” to your Telegram bot to verify the automation.
A working test should complete the full chain: Telegram receives your message, n8n triggers the workflow, the stock data node returns market information, Chart IMG creates the chart, OpenAI writes the summary, and Telegram sends the final result back to you.
What to Check Before You Activate the Workflow
Before you rely on the bot for daily research, check the workflow one node at a time. This makes errors easier to find and prevents you from guessing where the problem is.
- Telegram trigger: Confirm that your message reaches n8n.
- Ticker parsing: Make sure the workflow extracts the correct ticker from your message.
- TwelveData request: Confirm that the market data response is valid and not blocked by limits.
- Chart IMG request: Confirm that the generated chart matches the requested symbol and timeframe.
- OpenAI response: Check whether the summary is clear, balanced, and not too promotional.
- Telegram send node: Confirm that the final message reaches the correct chat.
Troubleshooting Common Issues
If your bot fails to respond, check your n8n execution log first. The log can show which node failed, what data entered the node, and what error came back from the service.
- No Telegram response: Check that the workflow is active and the Telegram trigger credentials are valid.
- Invalid stock symbol: Confirm that the ticker exists and that your data provider supports the exchange.
- No chart image: Check your Chart IMG API key, request format, and image response field.
- OpenAI error: Confirm that your API key is active and your account has enough usage access.
- Wrong recipient: Replace a fixed chat ID with the dynamic chat ID expression for multi-user workflows.
- Slow response: Review hosting performance, API rate limits, and the number of nodes in the workflow.
If you encounter errors, test each node individually to isolate the problem. Fix the first failing node before moving deeper into the workflow.
Benefits of Automation
This bot saves time by turning complex data into a quick visual and written summary. Instead of logging into several platforms, typing the same ticker repeatedly, and reading raw market output, you can request a chart and analysis from one Telegram conversation.
The biggest benefit is consistency. Your bot can use the same prompt, same chart settings, and same workflow every time. That makes it easier to compare one ticker request with another.
A stock analysis bot is most useful when it speeds up research, not when it replaces judgment. Use it to organize data, spot patterns, and prepare better questions before making financial decisions.
Conclusion
You have now built an automated stock analysis agent using no-code tools. This setup can deliver market charts and AI-generated insights directly to your phone through Telegram. With n8n as the automation engine, you can connect stock data, charting, and OpenAI into one simple workflow.
As a next step, experiment with different AI prompts, timeframes, and chart settings to change how your bot explains technical patterns. Keep your API keys private, monitor usage limits, and verify important market information before taking action. This bot can simplify your research process, but it should stay an educational and research-focused tool.
Disclaimer: This guide is for educational purposes only and does not constitute financial advice. Market data availability, accuracy, and latency depend on your data providers, plans, and exchanges. Always verify information with trusted platforms and consult a qualified professional before making financial decisions.
Frequently Asked Questions
Do I need to know coding to build this stock analysis bot?
No. The workflow uses n8n’s visual builder, so you connect services by configuring nodes, settings, and API keys instead of writing custom code.
Can I use this bot for any stock symbol worldwide?
In many cases, yes, but coverage depends on your market data provider, plan, exchange, and symbol. Some international, delayed, or low-volume stocks may not be available on every plan.
How can I host n8n for free?
You can host n8n locally on your own computer. This can reduce hosting costs, but your computer must stay online and n8n must keep running for the bot to respond.
What if I want to support multiple Telegram users?
Configure your n8n workflow to read the chat ID from each incoming message. Use {{$json["message"]["chat"]["id"]}} so replies go to the user who made the request.
Can I customize the AI analysis responses?
Yes. You can edit the prompt in your OpenAI node to change the response style, timeframe, risk language, and technical indicators the bot highlights.
Is this bot suitable for real-time trading decisions?
No. Use this tool for education, organization, and idea generation only. Always verify market data with trusted financial platforms before placing trades.
Why is my Telegram bot not replying?
Check whether the n8n workflow is active, the Telegram trigger is connected, the bot token is valid, and the send-message node is using the correct chat ID.
Can I change the chart timeframe?
Yes. Adjust the interval or timeframe parameter in the charting request. Make sure your data provider and chart service support the interval you choose.
Sources
- n8n Documentation — supports the use of n8n as a visual automation workflow platform.
- Telegram Bot Platform — supports Telegram bot creation and bot messaging concepts.
- OpenAI Platform Documentation — supports using OpenAI through API credentials and workflow integrations.
- TwelveData API Documentation — supports stock market data API usage and symbol/time-series concepts.
- Chart IMG — supports chart image generation for automated workflows.
Last Updated on June 27, 2026 by Logan Carter