This workflow corresponds to n8n.io template #14843 — we link there as the canonical source.
This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "8o0fo712OHfq5NZ5",
"name": "Warren Buffett Style Stock Analyzer",
"tags": [
{
"id": "8znohpKnw8UWpUXV",
"name": "Finance",
"createdAt": "2026-04-04T19:06:47.261Z",
"updatedAt": "2026-04-04T19:06:47.261Z"
},
{
"id": "iAT3xNNYy5ayYMai",
"name": "Telegram",
"createdAt": "2026-04-04T19:06:47.199Z",
"updatedAt": "2026-04-04T19:06:47.199Z"
},
{
"id": "uTa9o5O84yXLMQ9f",
"name": "AI Agent",
"createdAt": "2026-04-04T19:06:47.228Z",
"updatedAt": "2026-04-04T19:06:47.228Z"
}
],
"nodes": [
{
"id": "be5ab63d-fda5-4f5c-abc4-93c54e5a7eaf",
"name": "\ud83d\udcf1 Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
544,
-48
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"typeVersion": 1.1
},
{
"id": "45b7dc7f-bb23-4b79-92a9-30f2db4f2ff4",
"name": "\ud83d\udd24 Extract Ticker & User",
"type": "n8n-nodes-base.set",
"position": [
768,
-48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "assign_ticker",
"name": "ticker",
"type": "string",
"value": "={{ $json.message.text.toUpperCase().replace(/[^A-Z0-9.]/g, '').trim() }}"
},
{
"id": "assign_chat_id",
"name": "chat_id",
"type": "string",
"value": "={{ $json.message.chat.id }}"
},
{
"id": "assign_username",
"name": "username",
"type": "string",
"value": "={{ $json.message.from.first_name || $json.message.from.username || 'Investor' }}"
},
{
"id": "assign_email",
"name": "recipientEmail",
"type": "string",
"value": "user@example.com"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "ea9e5098-9e68-434a-a749-ff5a4e5c890f",
"name": "\ud83d\udce8 Send Acknowledgement",
"type": "n8n-nodes-base.telegram",
"position": [
992,
-48
],
"parameters": {
"text": "=\ud83d\udd0d *Analyzing {{ $('\ud83d\udd24 Extract Ticker & User').item.json.ticker }} using Warren Buffett's value investing framework...*\n\n\u23f3 Running live web research across:\n\u2022 Financial statements & 10-year history\n\u2022 Competitive moat assessment\n\u2022 Management quality review\n\u2022 DCF intrinsic value model\n\u2022 Margin of safety calculation\n\n_This usually takes 30\u201360 seconds. Results will be emailed to you._",
"chatId": "={{ $('\ud83d\udd24 Extract Ticker & User').item.json.chat_id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "9a8d70d5-1ad2-4c83-91f9-09797a48abd9",
"name": "\ud83e\udde0 Buffett AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1360,
-48
],
"parameters": {
"text": "=Analyze the company with ticker symbol: {{ $('\ud83d\udd24 Extract Ticker & User').item.json.ticker }}\n\nRequested by: {{ $('\ud83d\udd24 Extract Ticker & User').item.json.username }}\n\nDate of analysis: {{ $now.format('MMMM D, YYYY') }}\n\n",
"options": {
"maxIterations": 15,
"systemMessage": "You are Warren Buffett \u2014 the legendary value investor, Chairman of Berkshire Hathaway, and one of the greatest capital allocators in history. Your task is to perform a rigorous, research-backed investment analysis on the provided stock ticker using your core value investing philosophy.\n\nYou MUST use the web search tool extensively to gather current, real data before writing your analysis. Search for:\n1. Latest annual revenue, net income, EPS, and earnings releases\n2. Return on equity (ROE) for the past 10 years\n3. Free cash flow history and current levels\n4. Debt levels and balance sheet strength\n5. Current stock price, market cap, and P/E ratio\n6. Competitive position, moat analysis, market share\n7. Management quality, CEO track record, share buybacks, dividends\n8. Key risks: regulatory, competitive, technological\n9. Analyst price targets and independent DCF estimates\n10. Any recent material news (lawsuits, acquisitions, guidance)\n\nAFTER gathering all research, produce a comprehensive analysis covering ALL SEVEN sections below. Write in Warren Buffett's voice \u2014 plain-spoken, folksy, wise, occasionally self-deprecating, and always grounded in first principles. Use analogies (See's Candies, Coca-Cola, GEICO) where appropriate.\n\n---\n\n## TOOL USAGE \u2014 MANDATORY ORDER\n\nYou have access to these tools inside this workflow:\n1. Web Search (SerpAPI)\n2. Calculator\n\nUse them in this order:\n\n### STEP 1 \u2014 Web Search for current data\nUse SerpAPI extensively to gather current, real-world information for the company. Search for:\n1. Latest revenue, net income, EPS, and recent earnings results\n2. Return on equity (ROE) history and profitability trends\n3. Free cash flow and balance sheet strength\n4. Debt levels, cash position, and capital allocation\n5. Current stock price, market cap, valuation multiples\n6. Competitive moat, market share, and industry position\n7. Management quality, CEO track record, buybacks, dividends\n8. Recent material news, risks, lawsuits, acquisitions, or guidance\n9. Analyst expectations, price targets, and external valuation views\n\nPerform multiple focused searches. Prefer specific facts and recent sources over generic summaries.\n\n### STEP 2 \u2014 Calculator for valuation math\nUse the Calculator tool for all DCF and margin-of-safety calculations:\n- Growth projections\n- Discounting cash flows\n- Terminal value\n- Present value of terminal value\n- Intrinsic value per share\n- Margin of safety percentage\n\nDo not estimate DCF math mentally when the Calculator can be used.\n\n### STEP 3 \u2014 Final output\nAfter research and calculations, produce the final answer as a complete HTML document only, following the required structure below.\nDo not return markdown.\nDo not explain your process.\nReturn only the final HTML.\n\n---\n\n---\n\n## REQUIRED OUTPUT STRUCTURE\n\nGenerate your response as a fully formatted HTML email body using the exact structure below. Use inline CSS only (no external stylesheets). The output will be sent directly as an HTML Gmail message.\n\nUse this exact HTML template structure:\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"UTF-8\"></head>\n<body style=\"font-family: Georgia, 'Times New Roman', serif; max-width: 780px; margin: 0 auto; background: #fafaf8; color: #1a1a1a; padding: 0;\">\n\n<!-- HEADER BANNER -->\n<div style=\"background: #1a3a1a; color: #f5f0e8; padding: 32px 40px; border-radius: 8px 8px 0 0;\">\n <div style=\"font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #8fb88f; margin-bottom: 8px;\">Warren Buffett Value Investing Framework</div>\n <h1 style=\"margin: 0; font-size: 32px; font-weight: 400; color: #f5f0e8;\">[COMPANY NAME] <span style=\"font-size: 16px; color: #8fb88f;\">([TICKER])</span></h1>\n <div style=\"margin-top: 10px; font-size: 13px; color: #b8cbb8;\">Analysis Date: [DATE] \u00b7 Analyst: Warren Buffett (simulated) \u00b7 Berkshire Hathaway Research</div>\n <!-- VERDICT BADGE: Use appropriate color -->\n <!-- BUY = background #2d6a2d | HOLD = background #7a5c1e | AVOID = background #8b2020 -->\n <div style=\"display: inline-block; margin-top: 16px; padding: 8px 24px; border-radius: 20px; font-size: 14px; font-weight: bold; letter-spacing: 1px; background: [VERDICT_COLOR]; color: white;\">\n \u25cf VERDICT: [BUY / HOLD / AVOID]\n </div>\n</div>\n\n<!-- KEY METRICS STRIP -->\n<div style=\"background: #2c2c2c; padding: 20px 40px; display: flex; gap: 0;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n <tr>\n <td style=\"text-align: center; padding: 0 16px; border-right: 1px solid #444;\">\n <div style=\"font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px;\">Stock Price</div>\n <div style=\"font-size: 22px; font-weight: bold; color: #f5f0e8; margin-top: 4px;\">[PRICE]</div>\n </td>\n <td style=\"text-align: center; padding: 0 16px; border-right: 1px solid #444;\">\n <div style=\"font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px;\">Market Cap</div>\n <div style=\"font-size: 22px; font-weight: bold; color: #f5f0e8; margin-top: 4px;\">[MKTCAP]</div>\n </td>\n <td style=\"text-align: center; padding: 0 16px; border-right: 1px solid #444;\">\n <div style=\"font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px;\">Revenue</div>\n <div style=\"font-size: 22px; font-weight: bold; color: #f5f0e8; margin-top: 4px;\">[REVENUE]</div>\n </td>\n <td style=\"text-align: center; padding: 0 16px; border-right: 1px solid #444;\">\n <div style=\"font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px;\">ROE</div>\n <div style=\"font-size: 22px; font-weight: bold; color: [ROE_COLOR]; margin-top: 4px;\">[ROE]%</div>\n </td>\n <td style=\"text-align: center; padding: 0 16px; border-right: 1px solid #444;\">\n <div style=\"font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px;\">P/E Ratio</div>\n <div style=\"font-size: 22px; font-weight: bold; color: #f5f0e8; margin-top: 4px;\">[PE]x</div>\n </td>\n <td style=\"text-align: center; padding: 0 16px;\">\n <div style=\"font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px;\">Free Cash Flow</div>\n <div style=\"font-size: 22px; font-weight: bold; color: [FCF_COLOR]; margin-top: 4px;\">[FCF]</div>\n </td>\n </tr>\n </table>\n</div>\n\n<!-- MAIN CONTENT -->\n<div style=\"background: white; padding: 40px; border: 1px solid #e5e0d8; border-top: none;\">\n\n <!-- SECTION 1 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">1</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Business Understanding</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: #eaf3ea; color: #2d6a2d;\">[BADGE e.g. Crystal Clear]</span>\n </div>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin: 0;\">[BUSINESS_UNDERSTANDING_TEXT \u2014 write 3-4 paragraphs in Buffett's voice. Explain what the business does, how it makes money, its segments and revenue model. Be specific with real numbers from your research.]</p>\n </div>\n\n <hr style=\"border: none; border-top: 1px solid #e5e0d8; margin: 0 0 36px 0;\">\n\n <!-- SECTION 2 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">2</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Durable Competitive Moat</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: [MOAT_BADGE_BG]; color: [MOAT_BADGE_COLOR];\">[MOAT_STRENGTH]</span>\n </div>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin: 0;\">[MOAT_TEXT \u2014 3-4 paragraphs. Assess brand power, switching costs, network effects, cost advantages. Use the castle-and-moat metaphor. Be honest about weaknesses. Compare to See's Candies, Coca-Cola, or GEICO where applicable.]</p>\n </div>\n\n <hr style=\"border: none; border-top: 1px solid #e5e0d8; margin: 0 0 36px 0;\">\n\n <!-- SECTION 3 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">3</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Management Quality</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: [MGMT_BADGE_BG]; color: [MGMT_BADGE_COLOR];\">[MGMT_RATING]</span>\n </div>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin: 0;\">[MANAGEMENT_TEXT \u2014 2-3 paragraphs. CEO background and track record, capital allocation (buybacks, dividends, acquisitions), shareholder communication, SBC levels, any controversies.]</p>\n </div>\n\n <hr style=\"border: none; border-top: 1px solid #e5e0d8; margin: 0 0 36px 0;\">\n\n <!-- SECTION 4 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">4</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Financial Health (10-Year Review)</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: [FIN_BADGE_BG]; color: [FIN_BADGE_COLOR];\">[FIN_RATING]</span>\n </div>\n <!-- Financial Scorecard Table -->\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin-bottom: 20px; border: 1px solid #e5e0d8; border-radius: 6px; overflow: hidden;\">\n <thead>\n <tr style=\"background: #f5f0e8;\">\n <th style=\"padding: 10px 16px; text-align: left; font-size: 12px; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;\">Metric</th>\n <th style=\"padding: 10px 16px; text-align: center; font-size: 12px; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;\">Value</th>\n <th style=\"padding: 10px 16px; text-align: center; font-size: 12px; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;\">Buffett Standard</th>\n <th style=\"padding: 10px 16px; text-align: center; font-size: 12px; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;\">Pass/Fail</th>\n </tr>\n </thead>\n <tbody>\n <tr style=\"border-top: 1px solid #e5e0d8;\">\n <td style=\"padding: 10px 16px; font-size: 14px; color: #333;\">Return on Equity (ROE)</td>\n <td style=\"padding: 10px 16px; font-size: 14px; font-weight: 600; color: #333; text-align: center;\">[ROE_VALUE]%</td>\n <td style=\"padding: 10px 16px; font-size: 13px; color: #666; text-align: center;\">> 15% consistently</td>\n <td style=\"padding: 10px 16px; text-align: center;\"><span style=\"padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: [ROE_PASS_BG]; color: [ROE_PASS_COLOR];\">[ROE_PASS]</span></td>\n </tr>\n <tr style=\"border-top: 1px solid #e5e0d8; background: #fafaf8;\">\n <td style=\"padding: 10px 16px; font-size: 14px; color: #333;\">Free Cash Flow</td>\n <td style=\"padding: 10px 16px; font-size: 14px; font-weight: 600; color: #333; text-align: center;\">[FCF_VALUE]</td>\n <td style=\"padding: 10px 16px; font-size: 13px; color: #666; text-align: center;\">Positive & growing</td>\n <td style=\"padding: 10px 16px; text-align: center;\"><span style=\"padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: [FCF_PASS_BG]; color: [FCF_PASS_COLOR];\">[FCF_PASS]</span></td>\n </tr>\n <tr style=\"border-top: 1px solid #e5e0d8;\">\n <td style=\"padding: 10px 16px; font-size: 14px; color: #333;\">Debt / Equity Ratio</td>\n <td style=\"padding: 10px 16px; font-size: 14px; font-weight: 600; color: #333; text-align: center;\">[DE_RATIO]</td>\n <td style=\"padding: 10px 16px; font-size: 13px; color: #666; text-align: center;\">Low / Manageable</td>\n <td style=\"padding: 10px 16px; text-align: center;\"><span style=\"padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: [DE_PASS_BG]; color: [DE_PASS_COLOR];\">[DE_PASS]</span></td>\n </tr>\n <tr style=\"border-top: 1px solid #e5e0d8; background: #fafaf8;\">\n <td style=\"padding: 10px 16px; font-size: 14px; color: #333;\">Net Profit Margin</td>\n <td style=\"padding: 10px 16px; font-size: 14px; font-weight: 600; color: #333; text-align: center;\">[MARGIN]%</td>\n <td style=\"padding: 10px 16px; font-size: 13px; color: #666; text-align: center;\">Widening over time</td>\n <td style=\"padding: 10px 16px; text-align: center;\"><span style=\"padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: [MARGIN_PASS_BG]; color: [MARGIN_PASS_COLOR];\">[MARGIN_PASS]</span></td>\n </tr>\n <tr style=\"border-top: 1px solid #e5e0d8;\">\n <td style=\"padding: 10px 16px; font-size: 14px; color: #333;\">10-Year Profitability Record</td>\n <td style=\"padding: 10px 16px; font-size: 14px; font-weight: 600; color: #333; text-align: center;\">[PROFIT_HISTORY]</td>\n <td style=\"padding: 10px 16px; font-size: 13px; color: #666; text-align: center;\">Consistent profits</td>\n <td style=\"padding: 10px 16px; text-align: center;\"><span style=\"padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: [HIST_PASS_BG]; color: [HIST_PASS_COLOR];\">[HIST_PASS]</span></td>\n </tr>\n </tbody>\n </table>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin: 0;\">[FINANCIAL_HEALTH_TEXT \u2014 2-3 paragraphs of narrative commentary on the financials.]</p>\n </div>\n\n <hr style=\"border: none; border-top: 1px solid #e5e0d8; margin: 0 0 36px 0;\">\n\n <!-- SECTION 5 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">5</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Intrinsic Value (DCF Model)</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: [DCF_BADGE_BG]; color: [DCF_BADGE_COLOR];\">[DCF_VERDICT]</span>\n </div>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin-bottom: 20px;\">[DCF_INTRO \u2014 1 paragraph explaining assumptions: base earnings, growth rates years 1-5, years 6-10, discount rate, terminal growth rate. Use conservative Buffett-style assumptions.]</p>\n <!-- DCF Result Cards -->\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"12\" style=\"margin-bottom: 20px;\">\n <tr>\n <td width=\"25%\" style=\"padding: 4px;\">\n <div style=\"background: #f5f0e8; border-radius: 8px; padding: 16px; text-align: center;\">\n <div style=\"font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;\">Base Earnings</div>\n <div style=\"font-size: 20px; font-weight: bold; color: #1a3a1a;\">[BASE_EARNINGS]</div>\n </div>\n </td>\n <td width=\"25%\" style=\"padding: 4px;\">\n <div style=\"background: #f5f0e8; border-radius: 8px; padding: 16px; text-align: center;\">\n <div style=\"font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;\">PV 10-Year Earnings</div>\n <div style=\"font-size: 20px; font-weight: bold; color: #1a3a1a;\">[PV_10YR]</div>\n </div>\n </td>\n <td width=\"25%\" style=\"padding: 4px;\">\n <div style=\"background: #f5f0e8; border-radius: 8px; padding: 16px; text-align: center;\">\n <div style=\"font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;\">PV Terminal Value</div>\n <div style=\"font-size: 20px; font-weight: bold; color: #1a3a1a;\">[PV_TERMINAL]</div>\n </div>\n </td>\n <td width=\"25%\" style=\"padding: 4px;\">\n <div style=\"background: #1a3a1a; border-radius: 8px; padding: 16px; text-align: center;\">\n <div style=\"font-size: 11px; color: #8fb88f; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;\">Intrinsic Value/Share</div>\n <div style=\"font-size: 20px; font-weight: bold; color: white;\">[INTRINSIC_PER_SHARE]</div>\n </div>\n </td>\n </tr>\n </table>\n <!-- Price Comparison Bar -->\n <div style=\"background: #f5f0e8; border-radius: 8px; padding: 16px; display: flex; text-align: center;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n <tr>\n <td width=\"33%\" style=\"text-align: center; padding: 8px; border-right: 1px solid #d5cfc8;\">\n <div style=\"font-size: 11px; color: #888; margin-bottom: 4px;\">Intrinsic Value</div>\n <div style=\"font-size: 22px; font-weight: bold; color: #2d6a2d;\">[INTRINSIC_PER_SHARE]</div>\n </td>\n <td width=\"33%\" style=\"text-align: center; padding: 8px; border-right: 1px solid #d5cfc8;\">\n <div style=\"font-size: 11px; color: #888; margin-bottom: 4px;\">Current Price</div>\n <div style=\"font-size: 22px; font-weight: bold; color: [CURR_PRICE_COLOR];\">[CURRENT_PRICE]</div>\n </td>\n <td width=\"33%\" style=\"text-align: center; padding: 8px;\">\n <div style=\"font-size: 11px; color: #888; margin-bottom: 4px;\">Buy Price (25-30% MOS)</div>\n <div style=\"font-size: 22px; font-weight: bold; color: #7a5c1e;\">[BUY_TARGET]</div>\n </td>\n </tr>\n </table>\n </div>\n </div>\n\n <hr style=\"border: none; border-top: 1px solid #e5e0d8; margin: 0 0 36px 0;\">\n\n <!-- SECTION 6 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">6</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Margin of Safety</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: [MOS_BADGE_BG]; color: [MOS_BADGE_COLOR];\">[MOS_VERDICT]</span>\n </div>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin: 0;\">[MARGIN_OF_SAFETY_TEXT \u2014 2-3 paragraphs. State clearly whether there is a 25-30% margin of safety. Reference current price vs intrinsic value. Discuss what price would represent a good entry. Mention the 10-year holding comfort.]</p>\n </div>\n\n <hr style=\"border: none; border-top: 1px solid #e5e0d8; margin: 0 0 36px 0;\">\n\n <!-- SECTION 7 -->\n <div style=\"margin-bottom: 36px;\">\n <div style=\"display: flex; align-items: center; gap: 12px; margin-bottom: 16px;\">\n <div style=\"background: #1a3a1a; color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; flex-shrink: 0; text-align: center; line-height: 28px;\">7</div>\n <h2 style=\"margin: 0; font-size: 20px; font-weight: 600; color: #1a3a1a;\">Circle of Competence & Key Risks</h2>\n <span style=\"margin-left: auto; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; background: [COC_BADGE_BG]; color: [COC_BADGE_COLOR];\">[COC_VERDICT]</span>\n </div>\n <p style=\"line-height: 1.8; color: #333; font-size: 15px; margin-bottom: 20px;\">[CIRCLE_OF_COMPETENCE_TEXT \u2014 2 paragraphs. What is inside the circle, what is not. What you'd need to understand before investing.]</p>\n <!-- Risk List -->\n <div style=\"background: #fafaf8; border: 1px solid #e5e0d8; border-radius: 8px; padding: 16px;\">\n <div style=\"font-size: 12px; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;\">Key Risk Factors</div>\n [RISK_ITEMS \u2014 format each risk as: <div style=\"padding: 8px 0; border-bottom: 1px solid #e5e0d8; font-size: 14px; color: #333;\"><strong style=\"color: #1a3a1a;\">[Risk Name]:</strong> [Risk description]</div> ]\n </div>\n </div>\n\n <!-- VERDICT SECTION -->\n <div style=\"background: #1a3a1a; border-radius: 8px; padding: 32px; margin-top: 8px;\">\n <div style=\"font-size: 11px; color: #8fb88f; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px;\">Annual Letter to Shareholders \u2014 Final Verdict</div>\n <div style=\"font-size: 28px; font-weight: bold; color: white; margin-bottom: 20px;\">\u25cf [BUY / HOLD / AVOID]</div>\n <p style=\"line-height: 1.9; color: #d5e8d5; font-size: 15px; font-style: italic; margin: 0;\">[ANNUAL_LETTER_PARAGRAPH \u2014 Write a single, rich paragraph in Warren Buffett's annual letter voice. Should be 200-300 words. Plain-spoken, wise, use at least one analogy (See's Candies, GEICO, Coke, etc.), acknowledge what's good about the business even if avoiding, explain the pricing or moat concern clearly. End with either where you'd buy or why you're holding or why you're passing entirely.]</p>\n </div>\n\n</div>\n\n<!-- FOOTER -->\n<div style=\"background: #f0ebe3; padding: 20px 40px; border-radius: 0 0 8px 8px; border: 1px solid #e5e0d8; border-top: none;\">\n <p style=\"font-size: 11px; color: #999; margin: 0; line-height: 1.6;\">\u26a0\ufe0f <strong>Disclaimer:</strong> This analysis is AI-generated for educational purposes only, simulating Warren Buffett's publicly documented value investing framework. It is not financial advice. Always conduct your own due diligence before making investment decisions. Past performance is not indicative of future results.</p>\n <p style=\"font-size: 11px; color: #bbb; margin: 8px 0 0 0;\">Generated by n8n AI Agent \u00b7 Powered by Claude \u00b7 Analysis Date: [DATE]</p>\n</div>\n\n</body>\n</html>\n```\n\nIMPORTANT RULES:\n- Always populate ALL placeholder values with real researched data\n- Use these badge colors: Strong/Excellent = background #eaf3ea, color #2d6a2d | Moderate/Mixed = background #fef3e2, color #7a5c1e | Weak/Poor = background #fde8e8, color #8b2020\n- ROE_COLOR: green (#2d6a2d) if >15%, orange (#c17d00) if 10-15%, red (#8b2020) if <10%\n- FCF_COLOR: green if positive, red if negative\n- CURR_PRICE_COLOR: green if below intrinsic value, red if above\n- Verdict colors: BUY = #2d6a2d | HOLD = #7a5c1e | AVOID = #8b2020\n- Do NOT return markdown. Return ONLY the complete HTML document, nothing else before or after it."
},
"promptType": "define"
},
"typeVersion": 3.1,
"continueOnFail": true
},
{
"id": "9d6dfa06-5afb-4156-b2a1-0bc8107bbabb",
"name": "\ud83d\udd0d SerpAPI Web Search",
"type": "@n8n/n8n-nodes-langchain.toolSerpApi",
"position": [
1408,
144
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "028f0308-27ae-4a50-b5ff-62fb9f50049f",
"name": "\ud83d\udce7 Send Gmail Report",
"type": "n8n-nodes-base.gmail",
"position": [
2352,
-64
],
"parameters": {
"sendTo": "={{ $('\ud83d\udd24 Extract Ticker & User').item.json.recipientEmail }}",
"message": "={{ $('\ud83e\udde0 Buffett AI Agent').item.json.output }}",
"options": {
"appendAttribution": false
},
"subject": "=\ud83d\udcca Buffett Analysis: {{ $('\ud83d\udd24 Extract Ticker & User').item.json.ticker }} \u2014 {{ $('\ud83e\udde0 Buffett AI Agent').item.json.output.match(/VERDICT: (BUY|HOLD|AVOID)/)?.[1] || 'Analysis Complete' }} | {{ $now.format('dd/LL/yyyy') }}"
},
"typeVersion": 2.1
},
{
"id": "99fd2afb-8a4c-47f0-a044-d035e7894651",
"name": "\u2705 Telegram Confirmation",
"type": "n8n-nodes-base.telegram",
"position": [
2592,
-64
],
"parameters": {
"text": "=\u2705 *{{ $('\ud83d\udd24 Extract Ticker & User').item.json.ticker }} Analysis Complete!*\n\n\ud83d\udce7 Your full Warren Buffett-style report has been sent to your Gmail inbox.\n\n*Verdict:* {{ $('\ud83e\udde0 Buffett AI Agent').item.json.output.match(/VERDICT: (BUY|HOLD|AVOID)/)?.[1] || 'See email for details' }}\n\n_To analyze another stock, simply send me a new ticker symbol (e.g. AAPL, MSFT, AMZN)._",
"chatId": "={{ $('\ud83d\udd24 Extract Ticker & User').item.json.chat_id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "b18b9929-244b-4bc6-9808-c0a344248617",
"name": "\u274c Telegram Error Handler",
"type": "n8n-nodes-base.telegram",
"position": [
2400,
160
],
"parameters": {
"text": "=\u274c *Analysis Failed*\n\nSorry, I encountered an error analyzing *{{ $('\ud83d\udd24 Extract Ticker & User').item.json.ticker }}*.\n\nPlease check:\n\u2022 Is the ticker symbol correct? (e.g. AAPL, GOOGL, MSFT)\n\u2022 Try again in a moment\n\nDetails: {{ $json.output?.substring(0, 200) || 'No details available. Please try again.' }}",
"chatId": "={{ $('\ud83d\udd24 Extract Ticker & User').item.json.chat_id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "dcd52436-a925-4fdb-95f5-0d0b714fbfda",
"name": "\ud83d\udd0e Validate Ticker",
"type": "n8n-nodes-base.if",
"position": [
992,
-240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ticker_regex",
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $json.ticker }}",
"rightValue": "^[A-Z0-9.\\-]{1,10}$"
}
]
}
},
"typeVersion": 2
},
{
"id": "bcda63ad-bb06-4201-af76-dd7e1f8fa3c8",
"name": "\u26a0\ufe0f Invalid Ticker Reply",
"type": "n8n-nodes-base.telegram",
"position": [
1216,
-224
],
"parameters": {
"text": "=\u26a0\ufe0f *Invalid Input*\n\nPlease send a valid stock ticker symbol.\n\n*Examples:*\n\u2022 `AAPL` \u2014 Apple\n\u2022 `MSFT` \u2014 Microsoft\n\u2022 `GOOGL` \u2014 Alphabet\n\u2022 `AMZN` \u2014 Amazon\n\u2022 `BRK.B` \u2014 Berkshire Hathaway\n\n_Just type the ticker and hit send._",
"chatId": "={{ $('\ud83d\udd24 Extract Ticker & User').item.json.chat_id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "971f7cfd-3f14-4f3c-ad31-29309bed3e7a",
"name": "\ud83d\udd00 Check Agent Output",
"type": "n8n-nodes-base.if",
"position": [
1920,
-48
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "html_check",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.output }}",
"rightValue": "</html>"
}
]
}
},
"typeVersion": 2
},
{
"id": "18a45af2-bdd9-4c5d-8acd-d6a7fafe8848",
"name": "\ud83d\udccc Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-480
],
"parameters": {
"color": 6,
"width": 1800,
"height": 156,
"content": "## \ud83c\udfe6 Warren Buffett Style Stock Analyzer\n\nSend any **stock ticker** to your Telegram bot (e.g. `AAPL`, `MSFT`, `AMZN`) and receive a full **value investing analysis** in your Gmail inbox \u2014 written in Warren Buffett's voice.\n\n**The AI agent researches 10 data points in real-time** (financials, moat, management, DCF model, margin of safety) then delivers a formatted HTML report with a BUY / HOLD / AVOID verdict."
},
"typeVersion": 1
},
{
"id": "dc57917d-ccc2-48f8-8026-0138d283e8d2",
"name": "\ud83d\udccc Setup Required",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
-224
],
"parameters": {
"color": 5,
"width": 344,
"height": 472,
"content": "## \u2699\ufe0f Required Setup\n\n**1. Credentials to connect:**\n- \ud83d\udcf1 Telegram Bot API\n- \ud83d\udd0d SerpAPI (web search)\n- \ud83e\udd16 OpenAI API\n- \ud83d\udce7 Gmail OAuth2\n\n**2. Set your email:**\n\u2192 Open **\ud83d\udd24 Extract Ticker & User**\n\u2192 Change `recipientEmail` value to your Gmail\n\n**3. Create a Telegram bot:**\n\u2192 Message `@BotFather` on Telegram\n\u2192 Use `/newbot` command\n\u2192 Copy token to credentials\n\n**4. SerpAPI free tier:**\n\u2192 100 searches/month free\n\u2192 Sign up at serpapi.com"
},
"typeVersion": 1
},
{
"id": "cdecb44e-0c24-4f7a-9031-36e932e24639",
"name": "\ud83d\udccc Step 1 - Input",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
112
],
"parameters": {
"width": 420,
"height": 248,
"content": "## \ud83d\udce5 Step 1 - Input\n\n1. User sends ticker via Telegram\n2. Ticker is sanitized (uppercase, non-alpha stripped)\n3. Config node supplies recipient email\n4. **Validation** checks ticker is 1\u201310 chars\n5. Acknowledgement sent (sets expectations)\n\n\ud83d\udca1 *Tip: The bot also works for international tickers (e.g. `ASML`, `TSM`)*"
},
"typeVersion": 1
},
{
"id": "7f23301f-06ac-485c-b99e-426b6b5907e1",
"name": "\ud83d\udccc Step 2 - AI Engine",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
336
],
"parameters": {
"width": 460,
"height": 152,
"content": "## \ud83e\udde0 Step 2 - AI Engine\n\n**Agent tools (for qualitative research):**\n- \ud83d\udd0d **SerpAPI** \u2014 moat, management, news, analyst opinions\n- \ud83e\uddee **Calculator** \u2014 precise DCF arithmetic\n"
},
"typeVersion": 1
},
{
"id": "7863b9ce-c338-48a3-aca0-bb67e42db9ef",
"name": "\ud83d\udccc Step 3 - Output",
"type": "n8n-nodes-base.stickyNote",
"position": [
1760,
128
],
"parameters": {
"color": 2,
"width": 416,
"height": 296,
"content": "## \ud83d\udce4 Step 3 - Output\n\n1. **IF node** validates HTML output exists\n2. \u2705 Valid \u2192 Email + Telegram confirmation\n3. \u274c Invalid \u2192 Error message to Telegram\n\n\ud83d\udce7 *Gmail sends full HTML with inline CSS \u2014 renders as a styled financial report*\n\n\ud83d\udca1 *The verdict (BUY/HOLD/AVOID) is extracted from the HTML and shown in the Telegram reply and email subject.*"
},
"typeVersion": 1
},
{
"id": "1160468e-8a66-45fb-a67c-24668c2ef0d7",
"name": "\ud83d\udccc Error Handling",
"type": "n8n-nodes-base.stickyNote",
"position": [
2384,
352
],
"parameters": {
"color": 3,
"width": 300,
"height": 274,
"content": "## \u274c Error Handling\n\nTwo error paths are covered:\n\n**Path A** \u2014 Invalid ticker (too short/long)\n\u2192 Caught before agent runs\n\u2192 Sends friendly Telegram hint\n\n**Path B** \u2014 Agent failure or bad output\n\u2192 `continueOnFail` keeps workflow alive\n\u2192 IF node checks for valid HTML\n\u2192 Routes to this error message node"
},
"typeVersion": 1
},
{
"id": "fbbe50e7-8766-4315-9d7a-8998195ce9a7",
"name": "\ud83d\udccc Email Config",
"type": "n8n-nodes-base.stickyNote",
"position": [
2368,
-320
],
"parameters": {
"color": 4,
"width": 360,
"height": 240,
"content": "## \u2709\ufe0f Email Recipient\n\nSet your email in the **\ud83d\udd24 Extract Ticker & User** node \u2014 look for the `recipientEmail` field.\n\nChange `REPLACE_WITH_YOUR_GMAIL@gmail.com` to your actual Gmail address.\n\n*The Gmail account sending the report must be connected via OAuth2 in credentials.*"
},
"typeVersion": 1
},
{
"id": "bd736c98-560d-4809-a5ca-2c1f0b479b1e",
"name": "\ud83e\uddee Calculator (DCF Math)",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1584,
144
],
"parameters": {},
"typeVersion": 1
},
{
"id": "57fc76ab-2a97-4da1-a617-066d341819f6",
"name": "\ud83e\udd16 OpenAI GPT-4o-mini",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1184,
160
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {},
"builtInTools": {}
},
"typeVersion": 1.3
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"executionOrder": "v1"
},
"versionId": "35fe3dcf-4ef1-41a7-bcb7-3ef8f2416698",
"connections": {
"\ud83d\udd0e Validate Ticker": {
"main": [
[
{
"node": "\ud83d\udce8 Send Acknowledgement",
"type": "main",
"index": 0
}
],
[
{
"node": "\u26a0\ufe0f Invalid Ticker Reply",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcf1 Telegram Trigger": {
"main": [
[
{
"node": "\ud83d\udd24 Extract Ticker & User",
"type": "main",
"index": 0
}
]
]
},
"\ud83e\udde0 Buffett AI Agent": {
"main": [
[
{
"node": "\ud83d\udd00 Check Agent Output",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udce7 Send Gmail Report": {
"main": [
[
{
"node": "\u2705 Telegram Confirmation",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd00 Check Agent Output": {
"main": [
[
{
"node": "\ud83d\udce7 Send Gmail Report",
"type": "main",
"index": 0
}
],
[
{
"node": "\u274c Telegram Error Handler",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd0d SerpAPI Web Search": {
"ai_tool": [
[
{
"node": "\ud83e\udde0 Buffett AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"\ud83e\udd16 OpenAI GPT-4o-mini": {
"ai_languageModel": [
[
{
"node": "\ud83e\udde0 Buffett AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"\ud83d\udce8 Send Acknowledgement": {
"main": [
[
{
"node": "\ud83e\udde0 Buffett AI Agent",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd24 Extract Ticker & User": {
"main": [
[
{
"node": "\ud83d\udd0e Validate Ticker",
"type": "main",
"index": 0
}
]
]
},
"\ud83e\uddee Calculator (DCF Math)": {
"ai_tool": [
[
{
"node": "\ud83e\udde0 Buffett AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow turns a simple Telegram message into a full stock research report inspired by Warren Buffett’s value investing approach. A user sends a ticker symbol such as AAPL, MSFT, or AMZN, and the workflow validates the input, runs AI-powered research, performs discounted…
Source: https://n8n.io/workflows/14843/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
telegramAssistant. Uses telegramTrigger, agent, lmChatOpenAi, memoryBufferWindow. Event-driven trigger; 17 nodes.
BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.
Automate your personal productivity with this intelligent n8n workflow that integrates Telegram, Google Sheets, and OpenAI (GPT-4o). This system uses multiple AI agents to manage work hours, tasks, fi
This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.
This multi-agent n8n workflow delivers an automated, intelligent trading analysis system for the WEEX Spot Market. It uses GPT-4o to interpret user prompts, route them to the correct sub-agent tools,