AutomationFlowsAI & RAG › Nutri Assistant

Nutri Assistant

Nutri assistant. Uses agent, lmChatOpenAi, vectorStorePGVector, embeddingsOpenAi. Event-driven trigger; 22 nodes.

Event trigger★★★★☆ complexityAI-powered22 nodesAgentOpenAI ChatVector Store PgvectorOpenAI EmbeddingsMemory Postgres ChatTelegramTelegram TriggerForm Trigger
AI & RAG Trigger: Event Nodes: 22 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Embeddings 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 assistant",
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "6bcded11-00f1-451a-bfd5-1e437c653241",
              "leftValue": "={{ $json.tgrm_msg.text  === '/start' }}\n",
              "rightValue": "/start",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -4140,
        -720
      ],
      "id": "dac606ee-a6da-4a03-8e5e-2914fe349769",
      "name": "If start command called"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.tgrm_msg.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "id": "3ce89d69-4ffd-4b68-bfa3-12aa56ab8939"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "9d548d02-bb27-4094-bcab-eb241cee565e",
                    "leftValue": "={{ $json.message.voice }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "0c126a54-649a-47ab-a709-bc88f057b1d3",
                    "leftValue": "={{ $json.message.photo }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "bc2bb82e-b00e-4cb7-9243-0d53b0ecc5f2",
                    "leftValue": "={{ $json.message.document }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "document"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -4340,
        -480
      ],
      "id": "9fda2823-3982-47f0-ba7f-04f721a6d894",
      "name": "Filter for media type"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.tgrm_msg.text }}",
        "options": {
          "systemMessage": "\u0422\u044b \u2014 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 AI-\u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442 \u043f\u043e \u043d\u0443\u0442\u0440\u0438\u0446\u0438\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u043e\u043c\u0443 \u043f\u0438\u0442\u0430\u043d\u0438\u044e.  \n\u0422\u0432\u043e\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 **\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u0435\u0431\u0435 \u0437\u043d\u0430\u043d\u0438\u0439** \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (Vector Database \u0432 PostgreSQL), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0443\u0447\u043d\u044b\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u044b.\n\n- \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u0445 \u0438\u043b\u0438 \u043d\u0443\u0442\u0440\u0438\u0446\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u043e\u0432\u0435\u0442\u0430\u0445, \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 (Knowledge Base, Vector DB).\n- \u041d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0439 \u0441\u0432\u043e\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u0438 \u043d\u0435 \u0434\u0435\u043b\u0430\u0439 \u0432\u044b\u0432\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u0432 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439.\n- \u0415\u0441\u043b\u0438 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a \u0438 \u0441\u043a\u0430\u0436\u0438: \u201c\u0418\u0437\u0432\u0438\u043d\u0438\u0442\u0435, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443.\u201d\n- \u041d\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u0439 \u0441\u043e\u0432\u0435\u0442\u044b, \u0435\u0441\u043b\u0438 \u0443 \u0442\u0435\u0431\u044f \u043d\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439.\n\n\n\n**\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0432\u043e\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430:**\n- \u0415\u0441\u043b\u0438 \u0440\u0435\u0446\u0435\u043f\u0442 \u043d\u0430\u0439\u0434\u0435\u043d: \u201c\u0412\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0440\u0435\u0446\u0435\u043f\u0442: ... \\n\\n )\u201d\n- \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0442: \u201c\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443.\u201d\n\n\u0412 \u043a\u043e\u043d\u0446\u0435 \u0432\u0435\u0440\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0431\u0435 prompt, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u0431\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 Tool \u0438 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435: \n\u201c*\u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442)*:\n<\u0441\u044e\u0434\u0430 \u0432\u0441\u0442\u0430\u0432\u044c \u0432\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u043e\u0431\u043e\u0439 prompt \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u0431\u0435 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430> \u201c\\n\\n \n\u201c*\u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439:*\\n ...\u201c\n\n\u041e\u0442\u0432\u0435\u0442 \u0438 prompt \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 **Markdown \u0434\u043b\u044f Telegram (v1)**:\n- \u0418\u0437\u0431\u0435\u0433\u0430\u0439 \u043d\u0435\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (`*`, `_`, `[`).\n- \u042d\u043a\u0440\u0430\u043d\u0438\u0440\u0443\u0439 \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0435\u043a\u0441\u0442\u0430: `\\*`, `\\_`, ``\\` ``, `\\[`, `\\]`.\n---\n\u0423\u0431\u0435\u0434\u0438\u0441\u044c, \u0447\u0442\u043e \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 Telegram.",
          "maxIterations": 10,
          "returnIntermediateSteps": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -3460,
        -300
      ],
      "id": "4c9bb9b5-b2e0-40b4-81ce-2e590f667e57",
      "name": "AI Agent",
      "notesInFlow": true,
      "alwaysOutputData": true,
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {
          "temperature": 0.7,
          "topP": 1
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -3620,
        -140
      ],
      "id": "8ca38dc8-8c7e-4cbf-aca1-cf184a302b91",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0443\u0442\u0440\u0438\u0446\u0438\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u0445 \u0438\u0437 Postgres Vector DB ",
        "tableName": "rag_nutri_documents",
        "options": {
          "distanceStrategy": "cosine"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "typeVersion": 1.3,
      "position": [
        -3100,
        -140
      ],
      "id": "d3eaadb8-9be2-489e-881c-f5e5df604a7e",
      "name": "Postgres PGVector Store1",
      "notesInFlow": false,
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -3000,
        20
      ],
      "id": "ba38f9a0-7737-4a00-8543-4c84e2e4773c",
      "name": "Embeddings OpenAI1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.tgrm_msg.from.id }}",
        "tableName": "InteligentNutritionist_bot_chat_histories"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        -3400,
        -120
      ],
      "id": "d13543d7-f2a4-4ff9-b0ab-b8bd567119e1",
      "name": "Postgres Chat Memory",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        -4580,
        -440
      ],
      "id": "6126f9bd-1b8b-446d-bde1-1fa96aeb926e",
      "name": "Merge"
    },
    {
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "text": "\u041f\u0440\u0438\u0432\u0435\u0442, \u0441\u043f\u0440\u043e\u0441\u0438 \u043c\u0435\u043d\u044f, \u0447\u0442\u043e \u0445\u043e\u0447\u0435\u0448\u044c \u043f\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u043c. \u041d\u0430\u043f\u0438\u0448\u0438 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u043d\u0438\u0437\u0443",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -4860,
        -460
      ],
      "id": "4f4b3c7d-da49-4756-ab67-39b5e7648ebc",
      "name": "Send Hello after Start",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -6300,
        -260
      ],
      "id": "044bc806-ae49-4f86-a96a-62578b863422",
      "name": "Processing user input",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8022086a-ff51-4c4d-9118-f0cfd95650fa",
              "name": "message.text",
              "value": "\u041a\u0430\u0440\u0438\u0435\u0441",
              "type": "string"
            },
            {
              "id": "99daddd2-de23-4795-b6b2-a5b6b2f8569d",
              "name": "message.chat.id",
              "value": "123456789",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -4840,
        280
      ],
      "id": "621c3794-e8fd-4d73-b192-2d3b092a951a",
      "name": "Edit Fields",
      "disabled": true
    },
    {
      "parameters": {
        "formTitle": "Testing Nutri AI",
        "formFields": {
          "values": [
            {
              "fieldLabel": "message.text",
              "requiredField": true
            },
            {
              "fieldLabel": "message.chat.id",
              "placeholder": "123456789"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -6220,
        40
      ],
      "id": "b9937b59-34ef-4c4e-bcc7-e9f67886c299",
      "name": "On form submission",
      "disabled": true
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return {\n  json: {\n    telegramOriginal: $json,\n    userInput: $json.message?.text || '',\n    username: $json.message?.from?.username || ''\n  }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -6960,
        -180
      ],
      "id": "9db8b845-4c10-4148-ae6c-2befea5d3497",
      "name": "Code"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "4f63e0b6-1140-4016-9533-57925253ab32",
              "name": "telegramOriginal",
              "value": "={{ $json.telegramOriginal }}",
              "type": "object"
            },
            {
              "id": "1a897961-967d-4878-8a7a-c675fb7f72f8",
              "name": "userInput",
              "value": "={{ $json.userInput }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -6740,
        -160
      ],
      "id": "d096c53a-60b1-4c82-aec8-0e0db156be56",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -5700,
        300
      ],
      "id": "aa58c3aa-f25e-4aac-a0cb-49169d31c13c",
      "name": "Edit Fields2"
    },
    {
      "parameters": {
        "chatId": "{{ $json.tgrm_msg.chat.id }",
        "text": "\u0418\u0437\u0432\u0438\u043d\u0438\u0442\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -2280,
        -80
      ],
      "id": "341b8ef4-86e2-451f-a9cc-8bccfdcced3c",
      "name": "Send error message to user",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "994963580",
        "text": "=[BOT_MSG]\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \\n{{ $json.output }} ",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -2540,
        -80
      ],
      "id": "6f38178b-df44-4e99-aba5-60391d325a4d",
      "name": "Send Error Message from AI Agent to Admin",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        -2960,
        -380
      ],
      "id": "3c284a6b-f1f5-431e-b3c0-c1301b01621d",
      "name": "merge error with tgrm_msg"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        -2920,
        -640
      ],
      "id": "27fe182e-a0af-4d8e-8ebf-8b00fee9ee62",
      "name": "merge output with tgrm_msg"
    },
    {
      "parameters": {
        "chatId": "={{ $json.tgrm_msg.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -2680,
        -380
      ],
      "id": "81cc7e47-5a44-4ba7-99dd-3018852c7792",
      "name": "Send answer to user",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "operation": "upsert",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "tgrm_user",
          "mode": "list",
          "cachedResultName": "tgrm_user"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "bot": "={{ $json.tgrm_msg.from.is_bot }}",
            "id": "={{ $json.tgrm_msg.from.id }}",
            "chat_id": "={{ $json.tgrm_msg.chat.id }}",
            "user_name": "={{ $json.tgrm_msg.from.username }}",
            "first_name": "={{ $json.tgrm_msg.from.first_name }}",
            "active": "active",
            "full_name": "="
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": true,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "user_name",
              "displayName": "user_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "first_name",
              "displayName": "first_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "last_name",
              "displayName": "last_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "full_name",
              "displayName": "full_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "bot",
              "displayName": "bot",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "boolean",
              "canBeUsedToMatch": false
            },
            {
              "id": "chat_id",
              "displayName": "chat_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": false
            },
            {
              "id": "desc",
              "displayName": "desc",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "source",
              "displayName": "source",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "start_params",
              "displayName": "start_params",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "create_timestamp",
              "displayName": "create_timestamp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": false
            },
            {
              "id": "last_action",
              "displayName": "last_action",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            },
            {
              "id": "active",
              "displayName": "active",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -4740,
        -260
      ],
      "id": "b5594cc0-de1d-4bf9-bc04-3fcc4e6ba204",
      "name": "Save user data in DB",
      "alwaysOutputData": true,
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "jsCode": "return [{\n  json: {\n    tgrm_msg: $json.message}\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -5860,
        -260
      ],
      "id": "5b40398c-dfda-4a18-b430-af94ddaed043",
      "name": "Set data from telegram in tgrm_msg"
    }
  ],
  "connections": {
    "If start command called": {
      "main": [
        [
          {
            "node": "Send Hello after Start",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "merge output with tgrm_msg",
            "type": "main",
            "index": 0
          },
          {
            "node": "merge error with tgrm_msg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter for media type": {
      "main": [
        [
          {
            "node": "If start command called",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Filter for media type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "merge output with tgrm_msg",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "merge error with tgrm_msg",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send Hello after Start": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Processing user input": {
      "main": [
        [
          {
            "node": "Set data from telegram in tgrm_msg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        []
      ]
    },
    "Edit Fields2": {
      "main": [
        []
      ]
    },
    "Send Error Message from AI Agent to Admin": {
      "main": [
        [
          {
            "node": "Send error message to user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge error with tgrm_msg": {
      "main": [
        [
          {
            "node": "Send Error Message from AI Agent to Admin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge output with tgrm_msg": {
      "main": [
        [
          {
            "node": "Send answer to user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send answer to user": {
      "main": [
        [],
        [
          {
            "node": "Send Error Message from AI Agent to Admin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save user data in DB": {
      "main": [
        []
      ]
    },
    "Set data from telegram in tgrm_msg": {
      "main": [
        [
          {
            "node": "Save user data in DB",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "59c5903b-944e-4564-ac28-f49b1160123e",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "WoyBWgHRfFN3XuNj",
  "tags": [
    {
      "createdAt": "2025-07-07T19:23:25.810Z",
      "updatedAt": "2025-07-07T19:23:25.810Z",
      "id": "3HiknJDJv9SkqRic",
      "name": "Current"
    }
  ]
}

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 assistant. Uses agent, lmChatOpenAi, vectorStorePGVector, embeddingsOpenAi. Event-driven trigger; 22 nodes.

Source: https://github.com/stas-ka/sintaris-srv/blob/bbc2e3b15f970d54d781649510f4bf4f0e6f5b96/n8n/RAG-BOT/archive/Nutri_Assistant.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

A lightweight, self-hosted AI assistant built entirely in n8n. Multi-channel messaging (Telegram, WhatsApp, Gmail), persistent memory, task management, and autonomous work — all in a single visual wor

Telegram Trigger, OpenRouter Chat, Data Table +20
AI & RAG

Your AI workforce is ready. Are you?

Google Sheets Tool, Mcp Trigger, Google Drive +29
AI & RAG

This n8n workflow is built for AI and automation agencies to promote their workflows through an interactive demo that prospects can try themselves. The featured system is a deep personalized email dem

Telegram Trigger, HTTP Request, OpenAI +10
AI & RAG

Auto repost job with RAG is a workflow designed to automatically extract, process, and publish job listings from monitored sources using Google Drive, OpenAI, Supabase, and WordPress. This integration

Google Drive, Supabase Vector Store, OpenAI Embeddings +12
AI & RAG

RAG AI Agent Template V5. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, googleDrive. Event-driven trigger; 56 nodes.

OpenAI Chat, Document Default Data Loader, OpenAI Embeddings +12