AutomationFlowsAI & RAG › Market Agent [public]

Market Agent [public]

Market Agent [public]. Uses httpRequest, telegram. Scheduled trigger; 13 nodes.

Cron / scheduled trigger★★★★☆ complexity13 nodesHTTP RequestTelegram
AI & RAG Trigger: Cron / scheduled Nodes: 13 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Telegram 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 →

Download .json
{
  "name": "Market Agent [public]",
  "nodes": [
    {
      "parameters": {
        "url": "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=GOOGL&apikey=",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        400,
        -224
      ],
      "id": "abc8693b-8721-4f7d-9110-f2b57364d002",
      "name": "Precio GOOGLE",
      "retryOnFail": true
    },
    {
      "parameters": {
        "url": "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=AAPL&apikey=",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        304,
        -432
      ],
      "id": "e9beab71-101b-4ba5-a269-62cc1227c5bd",
      "name": "Precio Apple",
      "retryOnFail": true
    },
    {
      "parameters": {
        "url": "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=SPY&apikey=",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        400,
        -32
      ],
      "id": "a12d03ce-4059-42df-a89b-03eb6c449dd9",
      "name": "Precio SP500",
      "retryOnFail": true
    },
    {
      "parameters": {
        "url": "=https://newsapi.org/v2/everything?q=apple%20OR%20%22apple%20inc%22%20OR%20aapl%20OR%20iphone%20OR%20macbook&searchIn=title,description&language=en&sortBy=relevancy&from={{ $now.minus({days:2}).toISODate() }}&to={{ $now.toISODate() }}&apiKey=",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        304,
        176
      ],
      "id": "4d8a5251-f5c5-4bb3-a2d6-bf267cb48100",
      "name": "Noticias Apple",
      "retryOnFail": true
    },
    {
      "parameters": {
        "url": "=https://newsapi.org/v2/everything?q=google%20OR%20alphabet%20OR%20goog%20OR%20googl%20OR%20%22google%20stock%22%20OR%20%22alphabet%20stock%22&searchIn=title,description&language=en&sortBy=relevancy&from={{ $now.minus({days:2}).toISODate() }}&to={{ $now.toISODate() }}&apiKey=",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        304,
        368
      ],
      "id": "fe01bb09-ddaa-4299-871f-256d3bef4d33",
      "name": "Noticias Google",
      "retryOnFail": true
    },
    {
      "parameters": {
        "url": "=https://newsapi.org/v2/everything?q=%22S%26P%20500%22%20OR%20%22S%26P%22%20OR%20SPX%20OR%20%22US%20stocks%22%20OR%20%22stock%20market%22%20OR%20%22Wall%20Street%22&searchIn=title,description&language=en&sortBy=relevancy&from={{ $now.minus({days:2}).toISODate() }}&to={{ $now.toISODate() }}&apiKey=",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        304,
        560
      ],
      "id": "d6bdefb8-63ac-4768-9e46-209c56972cdc",
      "name": "Noticias SP500",
      "retryOnFail": true
    },
    {
      "parameters": {
        "jsCode": "const aaplRaw  = $('Precio Apple').first().json?.['Global Quote'] || {};\nconst googlRaw = $('Precio GOOGLE').first().json?.['Global Quote'] || {};\nconst spyRaw   = $('Precio SP500').first().json?.['Global Quote'] || {};\n\nconst aaplArticles  = $('Noticias Apple').first().json?.articles || [];\nconst googlArticles = $('Noticias Google').first().json?.articles || [];\nconst spyArticles   = $('Noticias SP500').first().json?.articles || [];\n\nconst parseAV = (quote) => {\n  const change = parseFloat(quote['09. change'] || 0);\n  const changePct = quote['10. change percent'] || '0%';\n  return {\n    symbol: quote['01. symbol'] || 'N/A',\n    price: parseFloat(quote['05. price'] || 0).toFixed(2),\n    change: change >= 0 ? `+${change.toFixed(2)}` : change.toFixed(2),\n    changePct: change >= 0 ? `+${changePct}` : changePct,\n    trend: change >= 0 ? '\ud83d\udcc8' : '\ud83d\udcc9'\n  };\n};\n\nconst aapl  = parseAV(aaplRaw);\nconst googl = parseAV(googlRaw);\nconst spy   = parseAV(spyRaw);\n\nconst MAX_NEWS = 5;\n\nconst formatNews = (articles, assetName) => {\n  if (!articles || articles.length === 0) {\n    return {\n      text: `Sin noticias disponibles para ${assetName}`,\n      linksHtml: ''\n    };\n  }\n\n  const available = articles.slice(0, MAX_NEWS);\n\n  const header = available.length < MAX_NEWS\n    ? `(${available.length} de ${MAX_NEWS} noticias disponibles)\\n`\n    : '';\n\n  const linksHtml = available\n    .filter(a => a.url)\n    .map((a, i) => `<a href=\"${a.url}\">[${i + 1}]</a>`)\n    .join(' ');\n\n  const lines = available.map((a, i) => {\n    const title  = a.title        || 'Sin t\u00edtulo';\n    const source = a.source?.name || 'Fuente desconocida';\n    return `${i + 1}. ${title} (${source})`;\n  });\n\n  return {\n    text: header + lines.join('\\n'),\n    linksHtml\n  };\n};\n\nconst aaplNews  = formatNews(aaplArticles,  'Apple');\nconst googlNews = formatNews(googlArticles, 'Google');\nconst spyNews   = formatNews(spyArticles,   'S&P 500');\n\nconst fecha = new Date().toLocaleDateString('es-CO', {\n  weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',\n  timeZone: 'America/Bogota'\n});\n\nconst systemPrompt = `Eres un analista financiero conciso. Generas reportes de mercado en espa\u00f1ol para Telegram.\n\nREGLAS:\n- Usa solo HTML que Telegram soporta: <b>, <i>, <pre>, emojis\n- NO uses markdown, asteriscos, ni otros tags\n- La tabla va dentro de <pre></pre> alineada con espacios\n- Basa el an\u00e1lisis de cada activo en las noticias provistas\n- NO incluyas referencias [1] [2] ni ning\u00fan n\u00famero entre corchetes en el texto del an\u00e1lisis\n- Los links ya est\u00e1n incluidos al final de cada secci\u00f3n, no necesitas citarlos en el texto\n- Si hay pocas o ninguna noticia, basa el an\u00e1lisis en el movimiento del precio\n- S\u00e9 directo y conciso\n- IMPORTANTE: al final del an\u00e1lisis de cada activo incluye exactamente el bloque de links que te doy, sin modificarlo`;\n\nconst userPrompt = `Genera un reporte de mercado para Telegram con estos datos reales:\n\nFecha: ${fecha}\nAAPL: $${aapl.price} | cambio: ${aapl.change} (${aapl.changePct}) | tendencia: ${aapl.trend}\nGOOGL: $${googl.price} | cambio: ${googl.change} (${googl.changePct}) | tendencia: ${googl.trend}\nSPY: $${spy.price} | cambio: ${spy.change} (${spy.changePct}) | tendencia: ${spy.trend}\n\nNoticias Apple:\n${aaplNews.text}\n\nNoticias Google:\n${googlNews.text}\n\nNoticias S&P 500:\n${spyNews.text}\n\nUsa exactamente este formato, respetando los bloques de links al pie de cada secci\u00f3n:\n\n<b>\ud83d\udcca Reporte de Mercado \u2014 ${fecha}</b>\n\n<pre>\nActivo  Precio      Cambio\nAAPL    $${aapl.price}    ${aapl.trend} ${aapl.changePct}\nGOOGL   $${googl.price}   ${googl.trend} ${googl.changePct}\nSPY     $${spy.price}    ${spy.trend} ${spy.changePct}\n</pre>\n\n<b>\ud83c\udf4e Apple (AAPL)</b>\n[an\u00e1lisis 2-3 l\u00edneas sin referencias num\u00e9ricas]\n${aaplNews.linksHtml}\n\n<b>\ud83d\udd0d Google (GOOGL)</b>\n[an\u00e1lisis 2-3 l\u00edneas sin referencias num\u00e9ricas]\n${googlNews.linksHtml}\n\n<b>\ud83d\udcca S&P 500 (SPY)</b>\n[an\u00e1lisis 2-3 l\u00edneas sin referencias num\u00e9ricas]\n${spyNews.linksHtml}`;\n\nconst llmBody = {\n  model: 'google/gemini-2.5-flash-lite',\n  messages: [\n    { role: 'system', content: systemPrompt },\n    { role: 'user', content: userPrompt }\n  ],\n  max_tokens: 2000\n};\n\nreturn [{ json: { llmBody } }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1104,
        48
      ],
      "id": "ccfbb000-ff5d-43e7-8dae-57deab9f9ebd",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify($json.llmBody) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1328,
        48
      ],
      "id": "7763f4c3-a2ed-45be-b559-206da17316e3",
      "name": "LLM call",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "-0000",
        "text": "={{ $json.choices[0].message.content }}",
        "additionalFields": {
          "appendAttribution": false,
          "parse_mode": "HTML"
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1536,
        48
      ],
      "id": "c315c0f1-5b4e-4451-9388-97c6a5949038",
      "name": "Send a text message",
      "executeOnce": false,
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "numberInputs": 6
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        864,
        -16
      ],
      "id": "d29e6b1c-5abb-49c6-b7d9-b6a0a3ea5801",
      "name": "Merge"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        224,
        -224
      ],
      "id": "b873958f-5af4-4764-a972-3ca8b193bb0c",
      "name": "Wait"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        224,
        -32
      ],
      "id": "f7c8d2cd-6608-45a6-98e0-82c192f6b5da",
      "name": "Wait1"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 12
            },
            {
              "triggerAtHour": 18
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        -160,
        -32
      ],
      "id": "418d8b31-7f27-4b57-9222-06cc1134bdd5",
      "name": "Schedule Trigger"
    }
  ],
  "connections": {
    "Precio Apple": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Precio GOOGLE": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Precio SP500": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Noticias Apple": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Noticias Google": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "Noticias SP500": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 5
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "LLM call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM call": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Precio GOOGLE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Precio SP500",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Precio Apple",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Noticias Apple",
            "type": "main",
            "index": 0
          },
          {
            "node": "Noticias Google",
            "type": "main",
            "index": 0
          },
          {
            "node": "Noticias SP500",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1a6ff2ff-a9fa-41f1-8516-817ab9258464",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "lvgtFH6aBG2r4TVA",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Market Agent [public]. Uses httpRequest, telegram. Scheduled trigger; 13 nodes.

Source: https://gist.github.com/Manre/af55d7b3a62f5fd911115fd774e53335 — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Master Agent - Orchestrator. Uses httpRequest, telegram, telegramTrigger. Scheduled trigger; 46 nodes.

HTTP Request, Telegram, Telegram Trigger
AI & RAG

Master Agent - Orchestrator. Uses httpRequest, telegram, telegramTrigger. Scheduled trigger; 44 nodes.

HTTP Request, Telegram, Telegram Trigger
AI & RAG

Master Agent - Orchestrator. Uses httpRequest, telegram, telegramTrigger. Scheduled trigger; 44 nodes.

HTTP Request, Telegram, Telegram Trigger
AI & RAG

Master Agent - Orchestrator. Uses httpRequest, telegram, telegramTrigger. Scheduled trigger; 44 nodes.

HTTP Request, Telegram, Telegram Trigger
AI & RAG

Master Agent - Orchestrator. Uses httpRequest, telegram, telegramTrigger. Scheduled trigger; 43 nodes.

HTTP Request, Telegram, Telegram Trigger