# Nutritionist AI agent with OpenAI and Postgres: n8n workflow

> Started by an incoming Telegram message, and works across Postgres and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents...

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

[Automation library](https://millionrounds.com/workflows) · [Chat assistants](https://millionrounds.com/workflows?category=Chat+assistants#library)

# Nutritionist AI agent with OpenAI and Postgres

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

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fnutritionist-ai-agent-with-openai-and-postgres)

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

**0** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 2 Model 9 Logic 1 Service 9

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

- 1 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 2 **Simple Memory** Memory Buffer Window *Model*
- 3 **Analyze_Image_Tool** Tool Workflow *Model*
- 4 **save to food_intake_tool** Postgres Tool *Service*
- 5 **query today food_intake** Postgres Tool *Service*
- 6 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 7 **save_recipes** Tool Workflow *Model*
- 8 **delete_recipe_by_id** Postgres Tool *Service*
- 9 **update_user_information** Postgres Tool *Service*
- 10 **get user information** Postgres Tool *Service*
- 11 **Schedule Trigger** Schedule trigger *Starts it*
- 12 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 13 **Telegram Trigger** Telegram trigger *Starts it*
- 14 **AI Agent** Agent *Model*
- 15 **Search For Recipes** Vector Store PGVector *Model*
- 16 **Postgres** Postgres *Service*
- 17 **AI Agent1** Agent *Model*
- 18 **Get user information** Postgres *Service*
- 19 **Telegram** Telegram *Service*
- 20 **Aggregate** Aggregate *Logic*
- 21 **Send scheduled summary** Telegram *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 21
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Postgres, Telegram
- **Model:** OpenAI
- **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 and Telegram accounts, and a key for OpenAI. 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. 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 21 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 21 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%2Fnutritionist-ai-agent-with-openai-and-postgres)
- **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)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also chat assistants, with the same services where possible, closest in size first.

- [**Diagnose website friction with Microsoft Clarity** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/diagnose-website-friction-with-microsoft-clarity)
- [**Manage recipes with Google Sheets** 21 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/manage-recipes-with-google-sheets)
- [**Telegram AI companion – Telegram chat, voice & image** 21 steps · calls a model · Telegram](https://millionrounds.com/workflow/telegram-ai-companion-telegram-chat-voice-and-image)
- [**Telegram AI companion – multimodal AI butler – Telegram chat** 21 steps · calls a model · Telegram](https://millionrounds.com/workflow/telegram-ai-companion-multimodal-ai-butler-telegram-chat)
- [**Validate compliance records with OpenAI and Google Sheets** 21 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/validate-compliance-records-with-openai-and-google-sheets)
- [**AI agent - RAG Telegram chatbot n8n with OpenAI** 22 steps · calls a model · Google Drive, Supabase vectors](https://millionrounds.com/workflow/ai-agent-rag-telegram-chatbot-n8n-with-openai)
