AutomationFlowsAI & RAG › Nutri V:1.0

Nutri V:1.0

Nutri v:1.0. Uses lmChatOpenAi, outputParserStructured, postgres, agent. Event-driven trigger; 7 nodes.

Event trigger★★☆☆☆ complexityAI-powered7 nodesOpenAI ChatOutput Parser StructuredPostgresAgentTelegram TriggerTelegram
AI & RAG Trigger: Event Nodes: 7 Complexity: ★★☆☆☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Chat 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 →

Download .json
{
  "name": "Nutri v:1.0",
  "nodes": [
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        416,
        736
      ],
      "id": "474b3fed-2cfe-470f-97b6-6fd446972a74",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"alimento\": [\"banana\", \"aveia\", \"iogurte natural\"],\n  \"quantidade_sugerida\": [\"1 unidade m\u00e9dia (120g)\", \"2 colheres de sopa (30g)\", \"1 pote (170g)\"],\n  \"calorias_estimadas\": [\"105 kcal\", \"117 kcal\", \"100 kcal\"],\n  \"tipo\": [\"lanche\", \"jantar\"],\n  \"total de carboidratos\": 29,\n  \"total de proteinas\":27,\n  \"total_calorias\": 322,\n  \"resumo\": \"Lan\u00e7amento registrado: R$30 com ra\u00e7\u00e3o no projeto Pessoal, pago via Pix.\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        800,
        736
      ],
      "id": "bcde7c76-58a6-4b54-ba68-ec5707c06cbd",
      "name": "Structured Output Parser1"
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "nutricionista",
          "mode": "list",
          "cachedResultName": "nutricionista"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "alimento": "={{ $json.output.alimento }}",
            "quantidadde": "={{ $json.output.quantidade_sugerida }}",
            "cal/cons/alim": "={{ $json.output.total_calorias }}",
            "tipo": "={{ $json.output.tipo[0] }}",
            "proteina": "={{ $json.output['total de proteinas'] }}",
            "carboidrato": "={{ $json.output['total de carboidratos'] }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "created_at",
              "displayName": "created_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "alimento",
              "displayName": "alimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "quantidadde",
              "displayName": "quantidadde",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "cal/cons/alim",
              "displayName": "cal/cons/alim",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "tipo",
              "displayName": "tipo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "proteina",
              "displayName": "proteina",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "carboidrato",
              "displayName": "carboidrato",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        912,
        480
      ],
      "id": "00f2704c-e764-489d-9022-003db4c03de9",
      "name": "Insert rows in a table1",
      "alwaysOutputData": false,
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "Voc\u00ea \u00e9 uma nutricionista esportiva com alto conhecimento especializada em emagrecimento saud\u00e1vel e baseado em ci\u00eancia. Seu objetivo \u00e9 ajudar o usu\u00e1rio a emagrecer, oferecendo as melhores combina\u00e7\u00f5es alimentares poss\u00edveis a partir das op\u00e7\u00f5es que ele fornecer.\nHoje esse paciente tem, 47 anos \u00e9 do sexo masculino e esta pesando 115 kg\nHoje o paciente toma como medicamento semanalmente Monjaro de 5 mg e diariamente toma Contrave e Venzer de 8mg.\nVoc\u00ea deve ter uma comunica\u00e7\u00e3o eduacada , explicativa e sugestiva quando receitar a dieta .\n\nO usu\u00e1rio ir\u00e1 informar os alimentos dispon\u00edveis ou consumidos em determinada refei\u00e7\u00e3o. Com base nisso, voc\u00ea deve:\n\nAvaliar se os itens s\u00e3o adequados para o objetivo de emagrecimento.\n\nSugerir a melhor combina\u00e7\u00e3o poss\u00edvel entre os itens mencionados, priorizando saciedade, baixo \u00edndice glic\u00eamico, qualidade nutricional e controle cal\u00f3rico.\n\nEvitar combina\u00e7\u00f5es com excesso de carboidratos simples, gorduras saturadas ou calorias vazias.\n\nIndicar alternativas melhores se a escolha for inadequada para o objetivo de emagrecer.\n\nManter uma linguagem acolhedora, direta e pr\u00e1tica.\n\nExemplo de entrada do usu\u00e1rio:\n\"Tenho: ovo, p\u00e3o integral, abacate, iogurte natural, banana, queijo branco\"\n\nExemplo de resposta esperada:\n\"Para seu objetivo de emagrecimento, a melhor combina\u00e7\u00e3o seria: 2 ovos mexidos com 1 fatia de p\u00e3o integral e uma colher de abacate. Isso garante saciedade com boas gorduras e prote\u00ednas. Evite a banana neste momento, pois \u00e9 mais indicada no pr\u00e9-treino ou como sobremesa controlada.\"\n\nQual seria uma op\u00e7\u00e3o melhor para essa refei\u00e7\u00e3o?\nreturn [{\n  refeicao: $json.refeicao,\n  disponiveis: $json.disponiveis,\n  sugestao: $json.choices[0].message.content\n}];\ndeve retornar com a melhor opcao dentro do que foi informado que tem para a refei\u00e7\u00e3o com o total de calorias sabendo que terei que emagrecer\nos dados ser\u00e3o inseridos no sql \"nutricionista\"\na coluna tipo quer dizer o tipo da alimenta\u00e7\u00e3o tipo, cafe da manha, \"almo\u00e7o\", \"lanche\", \"jantar\"\nQuando enviar calorias, proteina, carboidrato enviar o valor total.\n\n[Output mensagem de resposta]\nAp\u00f3s salvar os dados, responda com:\n\"\u2705 Refei\u00e7\u00e3o registrada com sucesso! Voc\u00ea consumiu: [lista de alimentos com quantidade e calorias]. Total estimado: [calorias totais] kcal.\"\n\nAp\u00f3s listar os dados, responda com:\n\"\u2705 Estas foram suas refei\u00e7\u00f5es de hoje: [lista de alimentos com quantidade e calorias de cada refei\u00e7\u00e3o]. Total estimado do dia: [soma de calorias] kcal.\"\n\nSe houver erro, responda com:\n\"\u274c N\u00e3o consegui registrar sua refei\u00e7\u00e3o. Pode repetir com mais detalhes ou verificar o formato?\"\n\n\n\n\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        512,
        496
      ],
      "id": "5ba32a43-50ce-40f9-85ad-a861cdb4f94a",
      "name": "AI Nutri1"
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        272,
        480
      ],
      "id": "c3729e7f-91d2-4c7b-b556-5e7bdab36292",
      "name": "Telegram Trigger1",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger1').item.json.message.from.id }}",
        "text": "=\"{{ $('AI Nutri1').item.json.output.resumo }}\n\n\u2705 Refei\u00e7\u00e3o registrada com sucesso! Voc\u00ea consumiu: {{ $json.alimento }}. \nNessas quantidades: {{ $json.quantidadde }}\nTotal estimado: calorias {{ $json['cal/cons/alim'] }} kcal, proteinas {{ $json.proteina }}, carboidratos {{ $json.carboidrato }}.\"\n",
        "additionalFields": {}
      },
      "name": "Enviar Resposta (Telegram)1",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        1168,
        448
      ],
      "id": "b3d75536-0afb-476d-b807-3caf3131204a",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger1').item.json.message.from.id }}",
        "text": "=\"{{ $('AI Nutri1').item.json.output.resumo }}\n\u2705 Refei\u00e7\u00e3o registrada com sucesso! Voc\u00ea consumiu: [lista de alimentos com quantidade e calorias]. Total estimado: {{ $json['cal/cons/alim'] }} kcal, proteinas {{ $json.proteina }}, carboidratos {{ $json.carboidrato }}.\"\n",
        "additionalFields": {}
      },
      "name": "Enviar Resposta (Telegram)",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        1024,
        672
      ],
      "id": "36c2f3ef-02b3-4b73-b994-eff165b4eab4",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Nutri1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Nutri1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Insert rows in a table1": {
      "main": [
        [
          {
            "node": "Enviar Resposta (Telegram)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Nutri1": {
      "main": [
        [
          {
            "node": "Insert rows in a table1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Enviar Resposta (Telegram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger1": {
      "main": [
        [
          {
            "node": "AI Nutri1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8aaeecc4-0448-4322-b291-bbe88a8b648a",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Kou8AznrMHSOGnpp",
  "tags": []
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Nutri v:1.0. Uses lmChatOpenAi, outputParserStructured, postgres, agent. Event-driven trigger; 7 nodes.

Source: https://github.com/Mfdemenezes/n8n-automations/blob/main/workflows/nutrition-agent/workflow.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

LinkedIn Growth & Intelligence Agent. Uses telegram, postgres, executeWorkflowTrigger, @brightdata/n8n-nodes-brightdata. Event-driven trigger; 46 nodes.

Telegram, Postgres, Execute Workflow Trigger +5
AI & RAG

This intelligent lead generation workflow transforms voice commands or text input into verified prospect lists through automated Apollo.io scraping. The system processes natural language requests, ext

Telegram, OpenAI, OpenAI Chat +7
AI & RAG

Fin_Sql_bot. Uses lmChatOpenAi, toolCalculator, agent, textClassifier. Event-driven trigger; 22 nodes.

OpenAI Chat, Tool Calculator, Agent +8
AI & RAG

SD 提示词助手. Uses agent, lmChatOpenAi, telegramTrigger, telegram. Event-driven trigger; 7 nodes.

Agent, OpenAI Chat, Telegram Trigger +3
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Mailgun, OpenAI, OpenAI Chat +8