Generate stock market insights with technical analysis, AI, and Telegram publishing
π AI Stock Analytics & BCS "Profit" Social Network Publishing Workflow
This workflow automatically generates stock market insights for selected tickers (e.g. GAZP, SBER, LKOH) using historical data, technical indicators, and an AI model. The results are then sent to Telegram for quick moderation and publishing.
π What this workflow does
- Runs twice a day on a schedule with a predefined list of tickers.
- Fetches historical market data from a broker API.
- Calculates key technical indicators (RSI, EMA/SMA, MACD, Bollinger Bands, ADX).
- Generates an investment post (title + summary) using an LLM.
- Stores results in a PostgreSQL database.
- Sends a draft post to Telegram with inline buttons βPublishβ and βRetryβ.
- Handles Telegram actions: publishes the post to the final channel or re-runs the generation process.
π Key features
- Multi-ticker support in a single run.
- Automatic error handling (e.g. missing data or invalid AI JSON output).
- Human-in-the-loop moderation through Telegram before publishing.
- PostgreSQL integration for history and analytics storage.
- Flexible structure: easy to extend with new tickers, indicators, or publishing channels.
π οΈ Nodes used
- Trigger: Schedule (twice daily) + Telegram Trigger (button callbacks).
- Data: HTTP Request (broker API), Function (technical analysis calculations).
- AI: OpenAI / OpenRouter with structured JSON output.
- Storage: PostgreSQL (analytics history).
- Messaging: Telegram (drafts and publishing).
π Who is this for
- Fintech startups looking to automate market content.
- Investment bloggers posting daily stock analysis.
- Analysts experimenting with trading strategies on real market data.
n8n Workflow: Generate Stock Market Insights with Technical Analysis, AI, and Telegram Publishing
This n8n workflow automates the process of fetching stock data, performing technical analysis, generating AI-powered insights, and publishing these insights to a Telegram channel. It can be triggered manually via Telegram commands or on a scheduled basis.
What it does
This workflow streamlines the creation and distribution of stock market analysis by:
- Triggering:
- Manually via Telegram: Listens for specific commands (e.g.,
/analyse) in a Telegram chat. - On a Schedule: Can be configured to run at predefined intervals (e.g., daily, hourly).
- Manually via Telegram: Listens for specific commands (e.g.,
- Processing Telegram Commands: If triggered by Telegram, it parses the incoming message to extract the stock ticker symbol.
- Fetching Stock Data: Makes an HTTP request to an external API to retrieve historical stock data for the specified ticker.
- Performing Technical Analysis: Executes a sub-workflow to apply technical analysis indicators to the fetched stock data.
- Generating AI Insights: Uses an AI agent (likely an LLM via OpenRouter) to generate human-readable insights based on the technical analysis results. It uses a structured output parser to ensure the AI output is in a usable format.
- Storing Data: Saves the raw stock data or analysis results into a PostgreSQL database.
- Publishing to Telegram: Sends the generated AI insights and any relevant data to a designated Telegram chat or channel.
- Hashing Data (Optional/Utility): Includes a Crypto node, potentially for hashing data before storage or for API authentication purposes (though its specific use isn't directly evident in the main flow).
- Conditional Logic: Uses
IfandSwitchnodes to control flow based on conditions (e.g., successful API calls, specific Telegram commands). - Data Transformation: Employs
Edit Fields (Set)andCodenodes for manipulating and preparing data at various stages of the workflow.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running n8n instance.
- Telegram Bot Token: A Telegram Bot Token and the Chat ID of the channel/group where messages will be sent and received.
- External Stock Data API Key: Access to a stock data API (e.g., Alpha Vantage, Yahoo Finance API, etc.) that provides historical stock data. The HTTP Request node will need to be configured with the appropriate endpoint and authentication.
- OpenRouter API Key: An API key for OpenRouter to access various AI language models.
- PostgreSQL Database: Access to a PostgreSQL database for storing stock data and analysis results. You will need the connection details (host, port, database, user, password).
- Sub-workflow for Technical Analysis: A separate n8n sub-workflow configured for performing technical analysis, which this main workflow will call.
Setup/Usage
- Import the Workflow: Import the provided JSON into your n8n instance.
- Configure Credentials:
- Set up a Telegram API credential using your Bot Token.
- Set up an OpenRouter API credential with your API key.
- Set up a PostgreSQL credential with your database connection details.
- If the stock data API requires authentication, configure an HTTP Request credential or embed the API key directly in the HTTP Request node.
- Configure Nodes:
- Telegram Trigger (ID: 50): Ensure it's listening for the desired commands (e.g.,
/analyse). - HTTP Request (ID: 19): Update the URL and any headers/parameters to match your chosen stock data API.
- Execute Sub-workflow (ID: 111): Specify the name or ID of your technical analysis sub-workflow.
- AI Agent (ID: 1119) & OpenRouter Chat Model (ID: 1281): Configure the AI agent with the appropriate prompt for generating insights and ensure the OpenRouter model is selected.
- Postgres (ID: 30): Configure the table name and columns for storing your data.
- Telegram (ID: 49): Set the Chat ID where the insights should be published.
- Schedule Trigger (ID: 839): If you want scheduled runs, configure the desired interval (e.g., every day at 9 AM).
- Telegram Trigger (ID: 50): Ensure it's listening for the desired commands (e.g.,
- Activate the Workflow: Once configured, activate the workflow to start processing Telegram commands or scheduled runs.
This workflow provides a robust framework for automating stock market analysis and communication, leveraging external APIs, AI, and database storage.
Related Templates
Generate song lyrics and music from text prompts using OpenAI and Fal.ai Minimax
Spark your creativity instantly in any chatβturn a simple prompt like "heartbreak ballad" into original, full-length lyrics and a professional AI-generated music track, all without leaving your conversation. π What This Template Does This chat-triggered workflow harnesses AI to generate detailed, genre-matched song lyrics (at least 600 characters) from user messages, then queues them for music synthesis via Fal.ai's minimax-music model. It polls asynchronously until the track is ready, delivering lyrics and audio URL back in chat. Crafts original, structured lyrics with verses, choruses, and bridges using OpenAI Submits to Fal.ai for melody, instrumentation, and vocals aligned to the style Handles long-running generations with smart looping and status checks Returns complete song package (lyrics + audio link) for seamless sharing π§ Prerequisites n8n account (self-hosted or cloud with chat integration enabled) OpenAI account with API access for GPT models Fal.ai account for AI music generation π Required Credentials OpenAI API Setup Go to platform.openai.com β API keys (sidebar) Click "Create new secret key" β Name it (e.g., "n8n Songwriter") Copy the key and add to n8n as "OpenAI API" credential type Test by sending a simple chat completion request Fal.ai HTTP Header Auth Setup Sign up at fal.ai β Dashboard β API Keys Generate a new API key β Copy it In n8n, create "HTTP Header Auth" credential: Name="Fal.ai", Header Name="Authorization", Header Value="Key [Your API Key]" Test with a simple GET to their queue endpoint (e.g., /status) βοΈ Configuration Steps Import the workflow JSON into your n8n instance Assign OpenAI API credentials to the "OpenAI Chat Model" node Assign Fal.ai HTTP Header Auth to the "Generate Music Track", "Check Generation Status", and "Fetch Final Result" nodes Activate the workflowβchat trigger will appear in your n8n chat interface Test by messaging: "Create an upbeat pop song about road trips" π― Use Cases Content Creators: YouTubers generating custom jingles for videos on the fly, streamlining production from idea to audio export Educators: Music teachers using chat prompts to create era-specific folk tunes for classroom discussions, fostering interactive learning Gift Personalization: Friends crafting anniversary R&B tracks from shared memories via quick chats, delivering emotional audio surprises Artist Brainstorming: Songwriters prototyping hip-hop beats in real-time during sessions, accelerating collaboration and iteration β οΈ Troubleshooting Invalid JSON from AI Agent: Ensure the system prompt stresses valid JSON; test the agent standalone with a sample query Music Generation Fails (401/403): Verify Fal.ai API key has minimax-music access; check usage quotas in dashboard Status Polling Loops Indefinitely: Bump wait time to 45-60s for complex tracks; inspect fal.ai queue logs for bottlenecks Lyrics Under 600 Characters: Tweak agent prompt to enforce fuller structures like [V1][C][V2][B][C]; verify output length in executions
AI-powered code review with linting, red-marked corrections in Google Sheets & Slack
Advanced Code Review Automation (AI + Lint + Slack) Whoβs it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting β all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0β10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your teamβs channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow β reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why itβs valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n β combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your teamβs review history transparent and centralized.
Auto-reply & create Linear tickets from Gmail with GPT-5, gotoHuman & human review
This workflow automatically classifies every new email from your linked mailbox, drafts a personalized reply, and creates Linear tickets for bugs or feature requests. It uses a human-in-the-loop with gotoHuman and continuously improves itself by learning from approved examples. How it works The workflow triggers on every new email from your linked mailbox. Self-learning Email Classifier: an AI model categorizes the email into defined categories (e.g., Bug Report, Feature Request, Sales Opportunity, etc.). It fetches previously approved classification examples from gotoHuman to refine decisions. Self-learning Email Writer: the AI drafts a reply to the email. It learns over time by using previously approved replies from gotoHuman, with per-classification context to tailor tone and style (e.g., different style for sales vs. bug reports). Human Review in gotoHuman: review the classification and the drafted reply. Drafts can be edited or retried. Approved values are used to train the self-learning agents. Send approved Reply: the approved response is sent as a reply to the email thread. Create ticket: if the classification is Bug or Feature Request, a ticket is created by another AI agent in Linear. Human Review in gotoHuman: How to set up Most importantly, install the gotoHuman node before importing this template! (Just add the node to a blank canvas before importing) Set up credentials for gotoHuman, OpenAI, your email provider (e.g. Gmail), and Linear. In gotoHuman, select and create the pre-built review template "Support email agent" or import the ID: 6fzuCJlFYJtlu9mGYcVT. Select this template in the gotoHuman node. In the "gotoHuman: Fetch approved examples" http nodes you need to add your formId. It is the ID of the review template that you just created/imported in gotoHuman. Requirements gotoHuman (human supervision, memory for self-learning) OpenAI (classification, drafting) Gmail or your preferred email provider (for email trigger+replies) Linear (ticketing) How to customize Expand or refine the categories used by the classifier. Update the prompt to reflect your own taxonomy. Filter fetched training data from gotoHuman by reviewer so the writer adapts to their personalized tone and preferences. Add more context to the AI email writer (calendar events, FAQs, product docs) to improve reply quality.