# AI-powered stock analysis with OpenAI and OpenRouter: n8n workflow

> Started by an incoming WhatsApp message, and works across Gmail, Supabase vectors, Telegram and WhatsApp.

Source: https://millionrounds.com/workflow/ai-powered-stock-analysis-with-openai-and-openrouter (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Research and reporting](https://millionrounds.com/workflows?category=Research+and+reporting#library)

# AI-powered stock analysis with OpenAI and OpenRouter

Started by an incoming WhatsApp message, and works across Gmail, Supabase vectors, Telegram and WhatsApp. It puts OpenAI and OpenRouter behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 54 steps: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI, OpenRouter Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fai-powered-stock-analysis-with-openai-and-openrouter)

**54 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**0** Loops or waits

**4** Services it connects to

## The flow

Starts it 5 Model 17 Logic 22 Service 10

The steps in the order they run, from what starts it.

- 1 **Think** Tool Think *Model*
- 2 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 3 **Recursive Character Text Splitter** Text Splitter Recursive Character Text Splitter *Model*
- 4 **Embeddings OpenAI1** Embeddings Open Ai *Model*
- 5 **Reranker Cohere** Reranker Cohere *Model*
- 6 **ranking** Http Request Tool *Service*
- 7 **sectors** Http Request Tool *Service*
- 8 **industries** Http Request Tool *Service*
- 9 **Technical Analysis Tool1** Tool Workflow *Model*
- 10 **Trends Analysis Tool1** Tool Workflow *Model*
- 11 **Think2** Tool Think *Model*
- 12 **Edit Fields1** Set *Logic*
- 13 **OpenRouter Chat Model2** Lm Chat Open Router *Model*
- 14 **Set Stock Symbol and API Key** Set *Logic*
- 15 **Generate Variables For API1** Code *Logic*
- 16 **Grok 4** Lm Chat Open Router *Model*
- 17 **Call trend + technical Agent** Tool Workflow *Model*
- 18 **Slack Trigger** Slack trigger *Starts it*
- 19 **Telegram Trigger** Telegram trigger *Starts it*
- 20 **Gmail Trigger** Gmail trigger *Starts it*
- 21 **WhatsApp Trigger** Whats App trigger *Starts it*
- 22 **When chat message received** Chat trigger *Starts it*
- 23 **MAIN AGENT** Agent *Model*
- 24 **Supabase Vector Store1** Vector Store Supabase *Model*
- 25 **Default Data Loader** Document Default Data Loader *Model*
- 26 **Supabase Vector Store** Vector Store Supabase *Model*
- 27 **Trend + Technical Agent** Agent *Model*
- 28 **Get Price History** Http Request *Service*
- 29 **Get Bollinger Bands** Http Request *Service*
- 30 **Get MACD** Http Request *Service*
- 31 **Split Out3** Split Out *Logic*
- 32 **Set message variable** Set *Logic*
- 33 **Markdown to HTML** Markdown *Logic*
- 34 **Calculate Support Resistance** Code *Logic*
- 35 **Edit Fields** Set *Logic*
- 36 **Merge** Merge *Logic*
- 37 **Edit Fields3** Set *Logic*
- 38 **Send report** Gmail *Service*
- 39 **Get Chart URL** Http Request *Service*
- 40 **Organizing Data** Code *Logic*
- 41 **Get News Data1** Http Request *Service*
- 42 **Download Chart** Http Request *Service*
- 43 **Merge-2** Merge *Logic*
- 44 **Aggregate1** Aggregate *Logic*
- 45 **First Technical Analysis** Open Ai *Model*
- 46 **Warp as JSON for GPT** Code *Logic*
- 47 **Code** Code *Logic*
- 48 **Set Variable** Set *Logic*
- 49 **Set Final Response** Set *Logic*
- 50 **Code1** Code *Logic*
- 51 **Split Out2** Split Out *Logic*
- 52 **Edit Fields4** Set *Logic*
- 53 **Limit1** Limit *Logic*
- 54 **Aggregate2** Aggregate *Logic*

## How it's built

- **Starts on:** An incoming WhatsApp message
- **Steps:** 54
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Supabase vectors, Telegram, WhatsApp
- **Model:** OpenAI, OpenRouter
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Supabase vectors, Telegram and WhatsApp accounts, and a key for OpenAI and OpenRouter. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming WhatsApp message.

Does it use AI?

Yes. It calls OpenAI and OpenRouter. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 54 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 54 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fai-powered-stock-analysis-with-openai-and-openrouter)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)[WhatsApp](https://millionrounds.com/workflows?service=WhatsApp#library)

## Workflows like it

Also research and reporting, with the same services where possible, closest in size first.

- [**Automated Google Business reports with OpenAI** 56 steps · calls a model · Gmail, Google Business Profile](https://millionrounds.com/workflow/automated-google-business-reports-with-openai)
- [**Create a Stakeholder 360 Report with OpenAI and Gmail** 56 steps · calls a model · Gmail, Notion](https://millionrounds.com/workflow/create-a-stakeholder-360-report-with-openai-and-gmail)
- [**Business AI command center: Modular agents** 58 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/business-ai-command-center-modular-agents)
- [**Automated US stock portfolio analysis with Telegram** 59 steps · calls a model · Postgres, Supabase](https://millionrounds.com/workflow/automated-us-stock-portfolio-analysis-with-telegram)
- [**Analyze Google Ads competitors with OpenRouter and OpenAI** 39 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/analyze-google-ads-competitors-with-openrouter-and-openai)
- [**Automate stock trades with Claude and OpenAI** 70 steps · calls a model · Gmail, Supabase vectors](https://millionrounds.com/workflow/automate-stock-trades-with-claude-and-openai)
