Automation library · Research and reporting

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.

LargeCalls a model: OpenAI, PerplexityRetrieval

59 stepsLarge: read it before trusting it with anything live
3Branches: places the flow splits
2Loops or waits
3Services it connects to

The flow

Starts it 2Model 19Logic 14Service 24

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

  1. 1OpenAI Chat Model1Lm Chat Open AiModel
  2. 2OpenAI Chat ModelLm Chat Open AiModel
  3. 3Schedule TriggerSchedule triggerStarts it
  4. 4OpenAI Chat Model2Lm Chat Open AiModel
  5. 5Structured Output ParserOutput Parser StructuredModel
  6. 6Telegram TriggerTelegram triggerStarts it
  7. 7OpenAI AnalysisLm Chat Open AiModel
  8. 8OpenAI ConversationLm Chat Open AiModel
  9. 9Postgres Chat MemoryMemory Postgres ChatModel
  10. 10update_walletSupabase ToolService
  11. 11OpenAI Chat Model3Lm Chat Open AiModel
  12. 12OpenAI Chat Model4Lm Chat Open AiModel
  13. 13OpenAI Chat Model5Lm Chat Open AiModel
  14. 14Structured Output Parser1Output Parser StructuredModel
  15. 15HTML FORMATTER AGENTAgentModel
  16. 16Auto-fixing Output ParserOutput Parser AutofixingModel
  17. 17Search ClientsPostgresService
  18. 18RESEARCH REQUEST SPECIALIST AGENTAgentModel
  19. 19GET Supabase UserSupabaseService
  20. 20Agent Analysis PDFAgentModel
  21. 21Conversation AgentAgentModel
  22. 22HTML FORMATTER AGENT1AgentModel
  23. 23Auto-fixing Output Parser1Output Parser AutofixingModel
  24. 24RESEARCH REQUEST SPECIALIST AGENT1AgentModel
  25. 25HTML Report GeneratorCodeLogic
  26. 26Loop Over ItemsSplit In BatchesLogic
  27. 27PARSE RESEARCHCodeLogic
  28. 28IF User ExistsIfLogic
  29. 29GET Supabase User1SupabaseService
  30. 30Send Reply ConversationTelegramService
  31. 31HTML Report Generator1CodeLogic
  32. 32PARSE RESEARCH1CodeLogic
  33. 33HTMLHtmlLogic
  34. 34Message a modelPerplexityService
  35. 35IF You Have PDFIfLogic
  36. 36Create Supabase UserSupabaseService
  37. 37IfIfLogic
  38. 38HTML1HtmlLogic
  39. 39Message a model1PerplexityService
  40. 40PDF GeneratorPDFco ApiService
  41. 41Perplexity Response FormatterCodeLogic
  42. 42Download PDF TelegramTelegramService
  43. 43SupabaseSupabaseService
  44. 44Update walletSupabaseService
  45. 45Created Supabase WalletSupabaseService
  46. 46PDF Generator1PDFco ApiService
  47. 47Perplexity Response Formatter1CodeLogic
  48. 48HTTP RequestHttp RequestService
  49. 49HTTP Request4Http RequestService
  50. 50CodeCodeLogic
  51. 51Send Analysis ConfirmationTelegramService
  52. 52HTTP Request3Http RequestService
  53. 53TelegramTelegramService
  54. 54WaitWaitLogic
  55. 55Telegram1TelegramService
  56. 56Update SentSupabaseService
  57. 57HTTP Request1Http RequestService
  58. 58Supabase1SupabaseService
  59. 59HTTP Request2Http RequestService

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.