This workflow corresponds to n8n.io template #7800 — we link there as the canonical source.
This workflow follows the Agent → Chat Trigger 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": "MeoXTIa3v9fjyJEy",
"meta": {
"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": "Introduction Note",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 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: \u201cKey drivers and risks?\u201d).\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": "Sticky Note12",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
848,
336
],
"parameters": {
"color": 7,
"width": 300,
"height": 252,
"content": "### Chat Trigger\n- Click \ud83d\udde8 Open chat to start\n- Flow: Chat \u2192 Agent \u2192 Discord\n- Activate the workflow to share a public chat URL\n"
},
"typeVersion": 1
},
{
"id": "f6cf061b-c11e-49d7-a8fc-e6752e98e14a",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note13",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 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\u20112.5\u2011flash\u2011lite; 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": "Example Chat",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"creator": "Aditya Vadaganadam",
"position": [
944,
432
],
"parameters": {
"public": true,
"options": {
"title": "Your Financial AI Agent \ud83d\ude80",
"subtitle": "This is for demo purposes. Try me out !",
"responseMode": "lastNode",
"inputPlaceholder": "Type your message here...",
"showWelcomeScreen": false
},
"initialMessages": "Hi there! \ud83d\udc4b"
},
"typeVersion": 1.1
},
{
"id": "0cf8cad8-a2d6-4ff2-aafd-70875e2c127a",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Conversation Memory",
"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": "Connect 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": {
"name": "<your credential>"
}
},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "e393c50c-c09e-4687-a5b1-db1fcd3e0c81",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 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 **\u201cCreate API key in new project\u201d** and copy it.\n\n2. Open the ```Connect Gemini``` node:\n * **Select Credential \u2192 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
],
"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": {
"name": "<your credential>"
}
},
"notesInFlow": false,
"typeVersion": 2
},
{
"id": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "agent1",
"type": "@n8n/n8n-nodes-langchain.agent",
"notes": "\u00a9 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": "Structured Output Parser",
"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": "Code",
"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": "Edit Fields",
"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": "Sticky Note1",
"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": "Sticky Note2",
"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\u2019s Gemini model and deliver clean, readable reports directly to a Discord channel via webhook. \n\nIt\u2019s 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\u2014no complex code required."
},
"typeVersion": 1
},
{
"id": "01448704-9c52-4684-878c-67b41d27bf08",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
-320
],
"parameters": {
"width": 672,
"height": 1360,
"content": "# Customization\n\n## Prompt control: \nEdit the \u201cAnalysis Instructions\u201d 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\u201cYou are a financial analyst. Be concise, evidence-based, and include clear caveats.\u201d\n\n### User context:\n\nTicker: {{ticker}}, Timeframe: {{timeframe}}\n\nQuestion: {{question}}\n\nIf data is provided, include \u201cAttached data:\u201d 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{\u2026}, actions[]"
},
"typeVersion": 1
},
{
"id": "4ea4fa42-cda6-45cd-a158-c9e00ffbdbf5",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note15",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1232,
624
],
"parameters": {
"color": 7,
"width": 260,
"height": 500,
"content": "### Conversation Memory \u2014 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 \u201cConversation Memory\u201d 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": "Sticky Note16",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 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\u2019s response against a schema so downstream formatting stays predictable\n- Default keys: `idea` (one\u2011line thesis) and `analysis` (Markdown sections)\n- Enable \u201cAuto\u2011fix\u201d 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\u2011line thesis\",\n \"analysis\": \"Markdown sections: Summary, Drivers, Risks, Metrics, Next Steps, Takeaway\"\n}\n\nTip: If outputs drift from the schema, tighten the agent\u2019s System Message and/or lower temperature."
},
"typeVersion": 1
},
{
"id": "613964aa-5378-4061-a5fa-3f8ab65c0990",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note17",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 2025 Aditya Vadaganadam",
"creator": "Aditya Vadaganadam",
"position": [
1664,
112
],
"parameters": {
"color": 7,
"width": 308,
"height": 468,
"content": "### Format Discord Message \u2014 final report\n- Purpose: Turn `output.idea` + `output.analysis` into a Discord\u2011ready 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 \u2014 split long content if needed.\n- Fallbacks: default idea (\u201cSummary\u201d), empty analysis if missing; lightly sanitize non\u2011Markdown.\n"
},
"typeVersion": 1
},
{
"id": "1bfd73d2-1c78-48b4-9f69-55db0e079e58",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note18",
"type": "n8n-nodes-base.stickyNote",
"notes": "\u00a9 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 \u2014 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,
"settings": {
"executionOrder": "v1"
},
"versionId": "6ffd90e1-754d-482b-8af9-c9acb78491df",
"connections": {
"Code": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"agent1": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Discord",
"type": "main",
"index": 0
}
]
]
},
"Example Chat": {
"main": [
[
{
"node": "agent1",
"type": "main",
"index": 0
}
]
]
},
"Connect Gemini": {
"ai_languageModel": [
[
{
"node": "agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Conversation Memory": {
"ai_memory": [
[
{
"node": "agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "agent1",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}
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.
discordWebhookApigooglePalmApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n template turns chat questions into structured financial reports using Gemini and posts them to a Discord channel via webhook. Ask about tickers, sectors, or theses (e.g., “NVDA long‑term outlook?” or “Gold ETF short‑term drivers?”) and receive a concise, shareable…
Source: https://n8n.io/workflows/7800/ — 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.
This Chatbot automates the process of discovering job openings and generating tailored job application emails.
ModelRouter. Uses chatTrigger, agent, modelSelector, httpRequest. Chat trigger; 28 nodes.
Revolutionize your client interactions with this Done‑For‑You AI Customer Service & Lead Routing System. This advanced n8n workflow, powered by Google Gemini and integrated with Notion, is pre-configu
This workflow creates an AI-powered chatbot that generates custom songs through an interactive conversation, then uploads the results to Google Drive.
This workflow is designed to intelligently route user queries to the most suitable large language model (LLM) based on the type of request received in a chat environment. It uses structured classifica