{
  "name": "Log meal nutrients from Telegram to Google Sheets using an AI agent",
  "nodes": [
    {
      "id": "cab4467e-449e-4823-abe5-eb0368883e9c",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        740,
        180
      ]
    },
    {
      "id": "a32a646b-80f2-46a4-81c2-7e3b5a4a192c",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        940,
        140
      ]
    },
    {
      "id": "3d934326-ad89-477f-9ab6-b97c04960597",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1160,
        140
      ]
    },
    {
      "id": "5a086fb6-6f12-40b6-aa82-64bb2d76b730",
      "name": "Get Audio File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        300,
        -280
      ]
    },
    {
      "id": "f72d4182-26e2-4026-8097-7e4cef50bfed",
      "name": "Transcribe Recording",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        520,
        -280
      ]
    },
    {
      "id": "0f3b227f-b15a-410c-9333-a40c3e1b95ee",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        1996,
        -80
      ]
    },
    {
      "id": "fddaae3c-d7e6-4cb4-bb23-f734dcbefb85",
      "name": "Receive Telegram message",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -140,
        -180
      ]
    },
    {
      "id": "9c6c00ca-e6f6-4f0b-b120-2249978379aa",
      "name": "If it's a voice message",
      "type": "n8n-nodes-base.if",
      "position": [
        80,
        -180
      ]
    },
    {
      "id": "97e56ec8-3a71-4e0d-a626-07a5113b09b7",
      "name": "Set chatInput from message",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        -80
      ]
    },
    {
      "id": "e1609f06-f769-4dfe-98e4-a56e95217307",
      "name": "Set chatInput from voice",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        -280
      ]
    },
    {
      "id": "42acb130-91f7-4d94-8b6b-c6b6b79f59f9",
      "name": "List of Ingredients and nutrients",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        960,
        -80
      ]
    },
    {
      "id": "b27195f2-cb45-45d8-ab87-60e76828f7c4",
      "name": "Explode the list",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1336,
        -80
      ]
    },
    {
      "id": "cf95c6a1-8ed4-45ee-90d0-fe87300c2968",
      "name": "Add date",
      "type": "n8n-nodes-base.code",
      "position": [
        1556,
        -80
      ]
    },
    {
      "id": "a0fd85ad-5cce-4419-af80-a6ff50a93631",
      "name": "Store in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1776,
        -80
      ]
    },
    {
      "id": "06ee2513-0622-450b-b195-84cdef13cd27",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -380
      ],
      "parameters": {
        "width": null,
        "height": 340,
        "content": "## Send a Telegram message\n1. To your channel with the list of what you ate during your last meal. \nYour input can be a written or a voice message."
      }
    },
    {
      "id": "fc4a2f5b-5565-4644-bd9f-74da73818698",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -380
      ],
      "parameters": {
        "width": 460,
        "height": null,
        "content": "## Setup\n1. Create a telegram Bot by following the instructions [here](https://docs.n8n.io/integrations/builtin/credentials/telegram/).\n2. Create an empty Google sheet and set it in \"Store in sheet\" a"
      }
    },
    {
      "id": "9e4e2ead-0c19-4799-8004-adaf30a5e0b1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1700,
        -220
      ],
      "parameters": {
        "width": null,
        "height": 320,
        "content": "## Check your data\n- to see if it seems correct \n- you can filter and sum your nutrients to check if you had enough! "
      }
    },
    {
      "id": "e57b8eef-d72d-46b2-ae1b-5d61a2c22d01",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -380
      ],
      "parameters": {
        "width": 640,
        "height": 260,
        "content": "## If it's an Audio file\nTRanscript it using openAI "
      }
    },
    {
      "id": "9bd1447e-bcde-4b4c-92c9-76120c9a42d2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        80
      ],
      "parameters": {
        "width": 340,
        "height": 260,
        "content": "## Testing\nYou can chat with the workflow by clicking on \"open chat\" to test your input and the response"
      }
    },
    {
      "id": "ac3a7c88-782a-4943-a332-2509287df840",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        -220
      ],
      "parameters": {
        "width": 340,
        "height": 320,
        "content": "## Personalize the prompt!!\n- It's a very simple one, you can of course make it better!"
      }
    },
    {
      "id": "58642d48-d97e-4a3d-84ea-a4de580e4c25",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2140,
        -220
      ],
      "parameters": {
        "width": null,
        "height": 320,
        "content": "## Personalize the response message\nYou can send the response of the Agent\nOr just be more polite! "
      }
    },
    {
      "id": "c6b8206c-bcb0-4034-8f99-9a4165770709",
      "name": "Respond message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2216,
        -80
      ]
    },
    {
      "id": "414d1da4-94e0-454d-acf9-a8344d1168b4",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -200
      ],
      "parameters": {
        "width": 460,
        "height": 260,
        "content": "## Contact me\n- If you need any modification to this workflow\n- if you need some help with this workflow\n- Or if you need any workflow in n8n, Make, or Langchain / Langgraph\n\nWrite to me: [thomas@poll"
      }
    }
  ],
  "connections": {
    "Limit": {
      "main": [
        [
          {
            "node": "Respond message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add date": {
      "main": [
        [
          {
            "node": "Store in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Audio File": {
      "main": [
        [
          {
            "node": "Transcribe Recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store in sheet": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Explode the list": {
      "main": [
        [
          {
            "node": "Add date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "List of Ingredients and nutrients",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Recording": {
      "main": [
        [
          {
            "node": "Set chatInput from voice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If it's a voice message": {
      "main": [
        [
          {
            "node": "Get Audio File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set chatInput from message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Telegram message": {
      "main": [
        [
          {
            "node": "If it's a voice message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set chatInput from voice": {
      "main": [
        [
          {
            "node": "List of Ingredients and nutrients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "List of Ingredients and nutrients",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Set chatInput from message": {
      "main": [
        [
          {
            "node": "List of Ingredients and nutrients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "List of Ingredients and nutrients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List of Ingredients and nutrients": {
      "main": [
        [
          {
            "node": "Explode the list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}