Agente de chatbot para informes de análisis financiero con Gemini y Discord
Este es unAI Chatbot, Multimodal AIflujo de automatización del dominio deautomatización que contiene 19 nodos.Utiliza principalmente nodos como Set, Code, Discord, Agent, ChatTrigger. Agente de chat para informes de análisis financiero basado en Gemini 2.5 Flash y Discord
- •Bot Token de Discord o Webhook
- •Clave de API de Google Gemini
Nodos utilizados (19)
Categoría
{
"id": "MeoXTIa3v9fjyJEy",
"meta": {
"instanceId": "dc6502f6723706f89d6fafb74f8b1c9e62669bc4f6e7235a97b3670f95fa0dfd",
"templateId": "6270",
"templateCredsSetupCompleted": true
},
"name": "Financial Analysis Report Chatbot Agent with Gemini and Discord",
"tags": [
{
"id": "7P7402AT8fl1UgKy",
"name": "discord",
"createdAt": "2025-08-24T21:42:42.394Z",
"updatedAt": "2025-08-24T21:42:42.394Z"
},
{
"id": "TiwQjTi7BRE6rBjx",
"name": "gemini",
"createdAt": "2025-08-24T21:42:35.574Z",
"updatedAt": "2025-08-24T21:42:35.574Z"
},
{
"id": "YXKQkUYk2OAFiNjz",
"name": "agent",
"createdAt": "2025-08-24T21:42:51.754Z",
"updatedAt": "2025-08-24T21:42:51.754Z"
},
{
"id": "izuNj2v182Li85ja",
"name": "financial",
"createdAt": "2025-08-24T21:42:48.732Z",
"updatedAt": "2025-08-24T21:42:48.732Z"
},
{
"id": "luHmOkpwxgGHf47m",
"name": "ai",
"createdAt": "2025-08-24T21:42:39.803Z",
"updatedAt": "2025-08-24T21:42:39.803Z"
}
],
"nodes": [
{
"id": "779e852e-a0b5-4cb7-b385-f9ac277f07a5",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota de Introducción",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
-672,
224
],
"parameters": {
"width": 552,
"height": 908,
"content": "# How it works!\n\nTrigger: \nRun manually, on schedule (Cron), or via webhook with query/body params.\n\nBuild Prompt & Variables: Set the ticker(s), timeframe, question, risk profile, and output style.\n\nGemini Analysis: Send a structured prompt to Gemini 1.5 Pro (or Flash) and get a focused financial narrative or JSON result.\n\nFormat Discord Message: Convert the AI response to a Discord-friendly message (headlines, bullets, code blocks or JSON).\n\nPost to Discord Webhook: Send the final report to your selected channel.\n\n\n\n# Setup instructions\n\n## Prerequisites\n\nAn n8n instance with internet access\n\nA Google AI (Gemini) API key\n\nA Discord server where you can create a webhook\n\nDiscord webhook\n\nIn Discord, go to Server Settings > Integrations > Webhooks.\n\nCreate a new webhook, pick the target channel, and copy the webhook URL.\n\nStore the URL as an n8n credential or environment variable (e.g., DISCORD_WEBHOOK_URL).\n\nGemini configuration\n\nCreate or obtain a Gemini API key from your Google AI account.\n\nChoose a model (e.g., gemini-1.5-pro for best reasoning; gemini-1.5-flash for speed).\n\nIn the Gemini Analysis node, reference the API key and model via variables (e.g., GEMINI_API_KEY, GEMINI_MODEL).\n\nUse structured prompts and optionally ask Gemini to return JSON for easier downstream formatting.\n\nTest run\n\nSet example values (ticker: AAPL, timeframe: 6M, question: “Key drivers and risks?”).\n\nExecute the workflow and confirm a formatted message is posted to your Discord channel.\n"
},
"typeVersion": 1
},
{
"id": "cd66718e-e76a-4bc4-9d4b-70f2aba4f0c3",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva12",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
848,
336
],
"parameters": {
"color": 7,
"width": 300,
"height": 252,
"content": "### Chat Trigger\n- Click 🗨 Open chat to start\n- Flow: Chat → Agent → Discord\n- Activate the workflow to share a public chat URL\n"
},
"typeVersion": 1
},
{
"id": "f6cf061b-c11e-49d7-a8fc-e6752e98e14a",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva13",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1232,
112
],
"parameters": {
"color": 7,
"width": 396,
"height": 476,
"content": "### Agent Instructions \nYour AI agent can:\n1. Receive chat questions (tickers, sectors, timeframe, thesis)\n2. Analyze with Gemini (drivers, risks, valuation/metrics, next steps)\n3. Post a formatted report to Discord via webhook\n\nCustomize:\n- Open the **agent1** node and edit the **System Message** (tone, depth, risk profile)\n- Pick model in **Connect Gemini** (e.g., gemini‑2.5‑flash‑lite; adjust temperature/tokens)\n- Ask for Markdown sections: Summary, Drivers, Risks, Metrics, Next Steps, Takeaway\n- Optionally fetch market/news/filings data before the agent and include it as context"
},
"typeVersion": 1
},
{
"id": "a524c281-bb72-45e9-912e-89e0f0946031",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Ejemplo de Chat",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"creator": "Aditya Vadaganadam",
"position": [
944,
432
],
"webhookId": "c4469360-faae-415c-86e2-58c6877acd85",
"parameters": {
"public": true,
"options": {
"title": "Your Financial AI Agent 🚀",
"subtitle": "This is for demo purposes. Try me out !",
"responseMode": "lastNode",
"inputPlaceholder": "Type your message here...",
"showWelcomeScreen": false
},
"initialMessages": "Hi there! 👋"
},
"typeVersion": 1.1
},
{
"id": "0cf8cad8-a2d6-4ff2-aafd-70875e2c127a",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Memoria de Conversación",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"creator": "Aditya Vadaganadam",
"position": [
1344,
720
],
"parameters": {
"contextWindowLength": 30
},
"typeVersion": 1.3
},
{
"id": "a1d663d0-bc10-4a1a-8807-e7f89453d386",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Conectar Gemini",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"notes": "adihere",
"creator": "Aditya Vadaganadam",
"position": [
944,
720
],
"parameters": {
"options": {
"temperature": 0,
"maxOutputTokens": 2048
},
"modelName": "models/gemini-2.5-flash-lite"
},
"credentials": {
"googlePalmApi": {
"id": "iHcmOfLEX7ID1xMU",
"name": "Google Gemini(PaLM) Api account 2"
}
},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "e393c50c-c09e-4687-a5b1-db1fcd3e0c81",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
848,
672
],
"parameters": {
"color": 3,
"width": 294,
"height": 316,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n1. [In Google AI Studio](https://aistudio.google.com/app/apikey) click **“Create API key in new project”** and copy it.\n\n2. Open the ```Connect Gemini``` node:\n * **Select Credential → Create New**\n * Paste into **API Key** and **Save**\n"
},
"typeVersion": 1
},
{
"id": "6d633d90-6de1-4abd-b61f-acd1747f82f5",
"name": "Discord",
"type": "n8n-nodes-base.discord",
"notes": "The message is via AI agent - DYOR",
"position": [
2320,
416
],
"webhookId": "f5222651-b196-428e-86c9-7df56d46dfea",
"parameters": {
"content": "=Welcome to your AI powered financial analyst - {{ $json.$workflow.name }}\n\nYou asked - {{ $('Example Chat').item.json.chatInput }}\n\nExecutive Summary - {{ $('agent1').item.json.output.idea }}\n\nA bit more of details {{ $json.clean }}\n\nDisclaimer:\nThis application uses generative artificial intelligence (AI) to provide financial insights and analyses. The content generated is for informational purposes only and should not be considered as professional financial advice or a recommendation to buy or sell any securities. Users are strongly encouraged to conduct their own independent research and consult with qualified financial advisors before making any investment decisions.\n\nThe information provided by this AI-powered tool is experimental and may contain errors, inaccuracies, or outdated information. We expressly disclaim any liability for losses or damages resulting from reliance on the content generated by this application. Use at your own risk.",
"options": {},
"authentication": "webhook"
},
"credentials": {
"discordWebhookApi": {
"id": "Xnz9dVPJXoYm4TIZ",
"name": "Discord Webhook account"
}
},
"notesInFlow": false,
"typeVersion": 2
},
{
"id": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "agente1",
"type": "@n8n/n8n-nodes-langchain.agent",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1312,
432
],
"parameters": {
"options": {
"systemMessage": "=<context>\n### Input\nThe user's query is provided from the previous node:\n\"{{$json[\"query\"]}}\"\n\n### Instructions\n- Analyze the query strictly from a financial analysis perspective. \n- Provide structured insights (such as risks, revenue potential, cost implications, investment outlook, etc.).\n- Be conversational, sarcastic, and bitey, but still educational.\n- Keep the tone frank and truth-focused, not sugar-coated. \n- Finish with a short but clear takeaway for the user.\n\n### Output\nGenerate the output in markdown format without any special characters \n</context>"
},
"hasOutputParser": true
},
"executeOnce": false,
"typeVersion": 2.2,
"alwaysOutputData": false
},
{
"id": "5329ee1f-839f-4f1b-b7f2-e82d1f337942",
"name": "Analizador de Salida Estructurada",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1584,
656
],
"parameters": {
"autoFix": "=",
"jsonSchemaExample": "{\n\t\"idea\": \"One liner title or idea\",\n\t\"analysis\": \"Analysis of the title \"\n}"
},
"typeVersion": 1.3
},
{
"id": "1ad975d2-ae80-40e6-93c3-f37ef20cd885",
"name": "Código",
"type": "n8n-nodes-base.code",
"position": [
1760,
448
],
"parameters": {
"jsCode": "let str = $input.first().json.output.analysis\n\n// Remove all special characters except letters, numbers, and spaces\nstr = str.replace(/[^a-zA-Z0-9 ]/g, '');\n\nreturn [{ json: { clean: str } }];"
},
"typeVersion": 2
},
{
"id": "3b2b60fd-5051-4731-b652-31d73ac0b337",
"name": "Editar Campos",
"type": "n8n-nodes-base.set",
"position": [
1984,
528
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "955d43bb-46f9-4189-9124-6d22b83c1834",
"name": "clean",
"type": "string",
"value": "={{ $json.clean }}"
},
{
"id": "8b267b8c-76ba-48cc-96f3-01abcd1f15df",
"name": "output.idea",
"type": "string",
"value": "={{ $('agent1').item.json.output.idea }}"
},
{
"id": "c88a0009-7c7f-4ffa-b8c8-3c63937ece3b",
"name": "chatInput",
"type": "string",
"value": "={{ $('Example Chat').item.json.chatInput }}"
},
{
"id": "948d9bd5-d0dd-48af-871c-0258bfa33d03",
"name": "$workflow.name",
"type": "string",
"value": "={{ $workflow.name }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "4dc108f0-6a49-4c02-9b99-bb3ece8f59a7",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2288,
560
],
"parameters": {
"color": 4,
"height": 400,
"content": "Get a webhook for a channel on Discord \n\nOfficial Discord Docs on creating and managing webhooks:\nhttps://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks\n\nn8n Docs on Discord credentials including webhook setup:\nhttps://docs.n8n.io/integrations/builtin/credentials/discord/"
},
"typeVersion": 1
},
{
"id": "40b4259b-45ff-4d08-b6a6-715e1450a60c",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-672,
-240
],
"parameters": {
"width": 528,
"height": 384,
"content": "# Overview of research agent \n\nThis template lets you run on-demand or scheduled financial analyses using Google’s Gemini model and deliver clean, readable reports directly to a Discord channel via webhook. \n\nIt’s ideal for teams that want quick insights (e.g., price trends, ratios, risk flags, and narrative summaries) without leaving Discord. The workflow accepts tickers, timeframes, and questions, prompts Gemini to analyze the context you provide (and optionally data you fetch upstream), then formats a concise report and posts it to your chosen channel. \n\nIt is designed to be easily customizable: tweak the prompt, model, output format, and metrics with a few fields—no complex code required."
},
"typeVersion": 1
},
{
"id": "01448704-9c52-4684-878c-67b41d27bf08",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
-320
],
"parameters": {
"width": 672,
"height": 1360,
"content": "# Customization\n\n## Prompt control: \nEdit the “Analysis Instructions” field to change voice, depth, and focus (e.g., fundamentals vs. technicals). Add a disclaimer or compliance note.\n\n## Output type: \nAsk Gemini for JSON with specific keys (summary, metrics, risks, actions), then format for Discord.\n\n### Data enrichment: \nInsert an HTTP Request node before analysis to fetch market data (e.g., OHLC, ratios) and pass it into the prompt.\n\n## Model selection: \nSwap between gemini-1.5-pro and gemini-1.5-flash via a variable for cost/speed trade-offs.\n\n### Scheduling and routing: \n\nAdd a Cron node for daily summaries or route different tickers to different Discord channels.\n\n### Notes\nThis workflow does not provide financial advice; verify outputs and consider adding a standardized disclaimer.\n\nIf you expect large inputs (tables, transcripts), use the 1.5 models and keep prompts concise.\n\n### Suggested fields and variables\n\nInputs: ticker, timeframe, question, risk_profile, output_format (markdown|json), channel_override\n\nSecrets: GEMINI_API_KEY, DISCORD_WEBHOOK_URL\n\nOptions: GEMINI_MODEL (default: gemini-1.5-pro), max_tokens, temperature\n\n\n### Example prompt scaffold (place in Build Prompt & Variables or the Code node)\n\n### System: \n“You are a financial analyst. Be concise, evidence-based, and include clear caveats.”\n\n### User context:\n\nTicker: {{ticker}}, Timeframe: {{timeframe}}\n\nQuestion: {{question}}\n\nIf data is provided, include “Attached data:” and summarize what to use.\n\n## Output format:\n\nMarkdown with sections: Summary, Drivers, Risks, Metrics, Next Steps\n\nOr JSON with keys: summary, drivers[], risks[], metrics{…}, actions[]"
},
"typeVersion": 1
},
{
"id": "4ea4fa42-cda6-45cd-a158-c9e00ffbdbf5",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva15",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1232,
624
],
"parameters": {
"color": 7,
"width": 260,
"height": 500,
"content": "### Conversation Memory — keep analyses on topic\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n- Maintains a sliding window of recent messages (default: 30) to give Gemini context\n- Improves coherence of financial analyses and the Discord report\n- Tune in the “Conversation Memory” node (contextWindowLength) to balance context vs. cost\n- Memory resets per chat session; clear manually when testing if needed\n"
},
"typeVersion": 1
},
{
"id": "6e895d59-ad8f-4fcf-8db2-bd048ca35e58",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva16",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1520,
624
],
"parameters": {
"color": 7,
"width": 260,
"height": 500,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### Structured Output Parser \n\nEnforce JSON for Discord report\n- Validates Gemini’s response against a schema so downstream formatting stays predictable\n- Default keys: `idea` (one‑line thesis) and `analysis` (Markdown sections)\n- Enable “Auto‑fix” to repair minor JSON issues; otherwise the agent may retry\n- If you add fields (e.g., `drivers[]`, `risks[]`, `metrics{}`), update the schema and the formatting node\n\nExample schema\n{\n \"idea\": \"One‑line thesis\",\n \"analysis\": \"Markdown sections: Summary, Drivers, Risks, Metrics, Next Steps, Takeaway\"\n}\n\nTip: If outputs drift from the schema, tighten the agent’s System Message and/or lower temperature."
},
"typeVersion": 1
},
{
"id": "613964aa-5378-4061-a5fa-3f8ab65c0990",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva17",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1664,
112
],
"parameters": {
"color": 7,
"width": 308,
"height": 468,
"content": "### Format Discord Message — final report\n- Purpose: Turn `output.idea` + `output.analysis` into a Discord‑ready Markdown report.\n- Inputs: `output.idea`, `output.analysis`, chat question, `$workflow.name`.\n- Customize: headings, sections/emojis, disclaimer, timestamps.\n- Discord limit: ~2000 chars/message — split long content if needed.\n- Fallbacks: default idea (“Summary”), empty analysis if missing; lightly sanitize non‑Markdown.\n"
},
"typeVersion": 1
},
{
"id": "1bfd73d2-1c78-48b4-9f69-55db0e079e58",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Nota Adhesiva18",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1920,
624
],
"parameters": {
"color": 7,
"width": 260,
"height": 436,
"content": "\n\n\n\n\n\n\n\n### Edit Fields — map data to Discord\n- Purpose: Select/rename fields for the Discord node.\n- Input: `clean` (Markdown report) from the Code node.\n- Output: `clean` (and any extra fields you add).\n- Customize: add `idea`, `chatInput`, `ticker`, `timeframe`, defaults, or computed values.\n- Tip: Keep field names consistent with the Discord message template."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "6ffd90e1-754d-482b-8af9-c9acb78491df",
"connections": {
"1ad975d2-ae80-40e6-93c3-f37ef20cd885": {
"main": [
[
{
"node": "3b2b60fd-5051-4731-b652-31d73ac0b337",
"type": "main",
"index": 0
}
]
]
},
"fdd3c5fe-c96e-48e3-9880-94204fd7c783": {
"main": [
[
{
"node": "1ad975d2-ae80-40e6-93c3-f37ef20cd885",
"type": "main",
"index": 0
}
]
]
},
"3b2b60fd-5051-4731-b652-31d73ac0b337": {
"main": [
[
{
"node": "6d633d90-6de1-4abd-b61f-acd1747f82f5",
"type": "main",
"index": 0
}
]
]
},
"a524c281-bb72-45e9-912e-89e0f0946031": {
"main": [
[
{
"node": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
"type": "main",
"index": 0
}
]
]
},
"a1d663d0-bc10-4a1a-8807-e7f89453d386": {
"ai_languageModel": [
[
{
"node": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"0cf8cad8-a2d6-4ff2-aafd-70875e2c127a": {
"ai_memory": [
[
{
"node": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
"type": "ai_memory",
"index": 0
}
]
]
},
"5329ee1f-839f-4f1b-b7f2-e82d1f337942": {
"ai_outputParser": [
[
{
"node": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Chatbot de IA, IA Multimodal
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
aditya vadaganadam
@adihereI help technology and business teams evolve through Agile, DevOps, cloud, and modern engineering practices—leveraging generative AI to build smarter, automated solutions. With 20+ years across global markets, I am leading an AI-powered transformations in finance, enabling teams to deliver faster and safer. I hold a Computer Engineering degree and an MBA, and remain hands-on with emerging GenAI, cloud, and DevOps technologies.
Compartir este flujo de trabajo