{
  "name": "Log food calories from images to Google Sheets using LINE and OpenAI Vision",
  "nodes": [
    {
      "id": "74a3253b-68d1-4745-85a1-70f5fa3260a9",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -592,
        48
      ]
    },
    {
      "id": "adf17e8b-4e45-4ad4-90e9-208b5bf6207f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        160,
        -160
      ]
    },
    {
      "id": "ef15eb25-64d9-4c30-becc-7f338d46ce55",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        32,
        48
      ]
    },
    {
      "id": "17e136f4-34f7-42c8-9793-19d13610aa49",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -96,
        272
      ]
    },
    {
      "id": "0359b260-8639-475b-8d47-cc76e004f027",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        576,
        272
      ]
    },
    {
      "id": "0535be0a-4aac-48a8-8909-41abca4944a0",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        176,
        48
      ]
    },
    {
      "id": "2851ca68-76c5-4b97-910d-2d4fa729754f",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        608
      ]
    },
    {
      "id": "bff30c01-da43-463d-940e-b396d8237c61",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        608,
        608
      ]
    },
    {
      "id": "1bf7ef0f-1e8d-4e61-b3bd-aaaefcf15366",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        272
      ]
    },
    {
      "id": "56bfb625-6b6b-480d-a81d-55ad8a629c57",
      "name": "LINE webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1040,
        144
      ]
    },
    {
      "id": "9e59d336-a880-42aa-b69c-66b445208d1c",
      "name": "user verification",
      "type": "n8n-nodes-base.if",
      "position": [
        -800,
        144
      ]
    },
    {
      "id": "11ddcfb0-a2e8-4002-ba64-bff77a4bf066",
      "name": "images download",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -368,
        272
      ]
    },
    {
      "id": "b40c936c-5273-493a-822f-36b44de906b3",
      "name": "only message",
      "type": "n8n-nodes-base.set",
      "position": [
        -128,
        -160
      ]
    },
    {
      "id": "599b110f-7771-4497-a41f-b231c3ebc3b8",
      "name": "send LINE",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1184,
        128
      ]
    },
    {
      "id": "978b63a0-fab0-445f-8f1b-0ab3b92f22b1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -64
      ],
      "parameters": {
        "width": 368,
        "height": 560,
        "content": "## LINE Food Image Calorie Logger to Google Sheets\n\nThis workflow allows a LINE user to send either text or an image of food to a connected LINE bot.\n\n- **Text message** → The AI agent responds direct"
      }
    },
    {
      "id": "78855553-f504-4ee0-913e-1b1c933f0cae",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        192
      ],
      "parameters": {
        "width": 704,
        "height": 272,
        "content": "## message to LINE"
      }
    },
    {
      "id": "e2180426-a161-4483-a630-63eb54cf0d29",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        512
      ],
      "parameters": {
        "width": 704,
        "height": 272,
        "content": "## write to Google Sheets"
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "only message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "images download",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "send LINE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "send LINE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LINE webhook": {
      "main": [
        [
          {
            "node": "user verification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "only message": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          },
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "images download": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "user verification": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}