# Automated US stock portfolio analysis with Telegram: n8n workflow

> Started by an incoming Telegram message, and works across Postgres, Supabase and Telegram.

Source: https://millionrounds.com/workflow/automated-us-stock-portfolio-analysis-with-telegram (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)

# Automated US stock portfolio analysis with Telegram

Started by an incoming Telegram message, and works across Postgres, Supabase and Telegram. It puts OpenAI and Perplexity behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 59 steps, 3 branches, 2 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI, Perplexity Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomated-us-stock-portfolio-analysis-with-telegram)

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

**3** Branches: places the flow splits

**2** Loops or waits

**3** Services it connects to

## The flow

Starts it 2 Model 19 Logic 14 Service 24

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

- 1 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 2 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 3 **Schedule Trigger** Schedule trigger *Starts it*
- 4 **OpenAI Chat Model2** Lm Chat Open Ai *Model*
- 5 **Structured Output Parser** Output Parser Structured *Model*
- 6 **Telegram Trigger** Telegram trigger *Starts it*
- 7 **OpenAI Analysis** Lm Chat Open Ai *Model*
- 8 **OpenAI Conversation** Lm Chat Open Ai *Model*
- 9 **Postgres Chat Memory** Memory Postgres Chat *Model*
- 10 **update_wallet** Supabase Tool *Service*
- 11 **OpenAI Chat Model3** Lm Chat Open Ai *Model*
- 12 **OpenAI Chat Model4** Lm Chat Open Ai *Model*
- 13 **OpenAI Chat Model5** Lm Chat Open Ai *Model*
- 14 **Structured Output Parser1** Output Parser Structured *Model*
- 15 **HTML FORMATTER AGENT** Agent *Model*
- 16 **Auto-fixing Output Parser** Output Parser Autofixing *Model*
- 17 **Search Clients** Postgres *Service*
- 18 **RESEARCH REQUEST SPECIALIST AGENT** Agent *Model*
- 19 **GET Supabase User** Supabase *Service*
- 20 **Agent Analysis PDF** Agent *Model*
- 21 **Conversation Agent** Agent *Model*
- 22 **HTML FORMATTER AGENT1** Agent *Model*
- 23 **Auto-fixing Output Parser1** Output Parser Autofixing *Model*
- 24 **RESEARCH REQUEST SPECIALIST AGENT1** Agent *Model*
- 25 **HTML Report Generator** Code *Logic*
- 26 **Loop Over Items** Split In Batches *Logic*
- 27 **PARSE RESEARCH** Code *Logic*
- 28 **IF User Exists** If *Logic*
- 29 **GET Supabase User1** Supabase *Service*
- 30 **Send Reply Conversation** Telegram *Service*
- 31 **HTML Report Generator1** Code *Logic*
- 32 **PARSE RESEARCH1** Code *Logic*
- 33 **HTML** Html *Logic*
- 34 **Message a model** Perplexity *Service*
- 35 **IF You Have PDF** If *Logic*
- 36 **Create Supabase User** Supabase *Service*
- 37 **If** If *Logic*
- 38 **HTML1** Html *Logic*
- 39 **Message a model1** Perplexity *Service*
- 40 **PDF Generator** PDFco Api *Service*
- 41 **Perplexity Response Formatter** Code *Logic*
- 42 **Download PDF Telegram** Telegram *Service*
- 43 **Supabase** Supabase *Service*
- 44 **Update wallet** Supabase *Service*
- 45 **Created Supabase Wallet** Supabase *Service*
- 46 **PDF Generator1** PDFco Api *Service*
- 47 **Perplexity Response Formatter1** Code *Logic*
- 48 **HTTP Request** Http Request *Service*
- 49 **HTTP Request4** Http Request *Service*
- 50 **Code** Code *Logic*
- 51 **Send Analysis Confirmation** Telegram *Service*
- 52 **HTTP Request3** Http Request *Service*
- 53 **Telegram** Telegram *Service*
- 54 **Wait** Wait *Logic*
- 55 **Telegram1** Telegram *Service*
- 56 **Update Sent** Supabase *Service*
- 57 **HTTP Request1** Http Request *Service*
- 58 **Supabase1** Supabase *Service*
- 59 **HTTP Request2** Http Request *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 59, with 3 branches, 2 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Postgres, Supabase, Telegram
- **Model:** OpenAI, Perplexity
- **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 Postgres, Supabase and Telegram accounts, and a key for OpenAI and Perplexity. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

Yes. It calls OpenAI and Perplexity. 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 59 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 59 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%2Fautomated-us-stock-portfolio-analysis-with-telegram)
- **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.

[Postgres](https://millionrounds.com/workflows?service=Postgres#library)[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

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

- [**Business AI command center: Modular agents** 58 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/business-ai-command-center-modular-agents)
- [**AI-powered stock analysis with OpenAI and OpenRouter** 54 steps · calls a model · Gmail, Supabase vectors](https://millionrounds.com/workflow/ai-powered-stock-analysis-with-openai-and-openrouter)
- [**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)
- [**Multi-source news curator with Mistral** 86 steps · calls a model · Email, RSS](https://millionrounds.com/workflow/multi-source-news-curator-with-mistral)
- [**AI-powered Telegram news broadcaster with Gemini and MongoDB** 29 steps · calls a model · MongoDB, RSS](https://millionrounds.com/workflow/ai-powered-telegram-news-broadcaster-with-gemini-and-mongodb)
- [**Collect viral Instagram AI art with OpenAI and Telegram** 28 steps · calls a model · Apify, Google Sheets](https://millionrounds.com/workflow/collect-viral-instagram-ai-art-with-openai-and-telegram)
