{
  "name": "Line chatbot with Google Sheets memory and Gemini AI",
  "nodes": [
    {
      "id": "[CENSORED]",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        560,
        -500
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        460,
        -220
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        460,
        -20
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        -500
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1276,
        -220
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Get History",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1000,
        -500
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Prepare Prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1220,
        -500
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Save History",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1056,
        -220
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -560
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "### Connect to Line Official Account's API"
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -560
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "Prepare the data"
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -560
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "Retrieve chat history"
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        -560
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "Give our AI previous chat history"
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -280
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Get input with this command.   \"{{ $json.Prompt }}\""
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        -280
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "Split history into small chunks (data cleaning)"
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Split History",
      "type": "n8n-nodes-base.code",
      "position": [
        840,
        -220
      ]
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -280
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "Save to Google Sheets"
      }
    },
    {
      "id": "[CENSORED]",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        -280
      ],
      "parameters": {
        "width": 180,
        "height": null,
        "content": "Send it back to Line"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Split History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Get History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get History": {
      "main": [
        [
          {
            "node": "Prepare Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save History": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split History": {
      "main": [
        [
          {
            "node": "Save History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}