{
  "name": "Trading journal: log trades into Google Sheets via Telegram & Gemini AI",
  "nodes": [
    {
      "id": "323e6adb-5692-4a54-ba6e-8b1709094837",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -740,
        -80
      ]
    },
    {
      "id": "992528a7-11e0-4ab2-82ef-622fee127597",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        780,
        780
      ]
    },
    {
      "id": "7819c8ac-14bc-4415-bd0f-de48307da67f",
      "name": "Generate Unique Trade ID",
      "type": "n8n-nodes-base.code",
      "position": [
        840,
        -20
      ]
    },
    {
      "id": "a1f8fb0c-c6d5-416e-9b1d-8159645d9259",
      "name": "Update the Sheet With Profit & Loss",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1160,
        -440
      ]
    },
    {
      "id": "ad5a1fc1-5f4d-4e1a-beb0-e0d88de366b5",
      "name": "Log The Trade In Google Sheets Journal",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1180,
        -20
      ]
    },
    {
      "id": "cc013e2d-c767-4a13-b631-447aa50e5597",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -80,
        360
      ]
    },
    {
      "id": "c43a29b7-bf84-401f-8b6d-e32e4ecc5d0b",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -400,
        380
      ]
    },
    {
      "id": "e88f40f2-d772-443b-b269-0e742fa78078",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -400
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "72d1855e-0618-42d6-ac41-23137e8c2dd2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -400
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "7587987d-a8b1-4f3d-b9e3-fe1bec5a59da",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        180
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "2b9fbcc0-dd8a-49aa-add3-dc7d7f4d65fd",
      "name": "Extract Journal Entry Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        20,
        -80
      ]
    },
    {
      "id": "9ab1a158-30eb-4a55-8eb5-2a80275f1b27",
      "name": "If (Trade Found => True)",
      "type": "n8n-nodes-base.if",
      "position": [
        240,
        -80
      ]
    },
    {
      "id": "bcbf30ee-5042-4c48-8f68-13deff37fbdc",
      "name": "Existing Entry Update OR New Entry",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        -280
      ]
    },
    {
      "id": "6ef1ea61-9e00-42fe-a58c-00a5f6303368",
      "name": "Send Response Back",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1600,
        -440
      ]
    },
    {
      "id": "d133cb4b-84ba-4362-a2dc-f4cbd9888de9",
      "name": "Send Trade ID to Telegram For Further Updates",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1600,
        -20
      ]
    },
    {
      "id": "f65eb562-e133-4062-8b13-d4f8f408b34f",
      "name": "Agent Handles (If Trade Is Not Found)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        840,
        340
      ]
    },
    {
      "id": "54cd0864-fdbf-4823-baac-7ee42e72a431",
      "name": "Sends Response Back To Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1600,
        340
      ]
    },
    {
      "id": "6c647990-5a82-4fe9-9887-0b91c24eff9c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        -800
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "dbf18695-9ee5-4d04-b174-f3d8a8d4fe44",
      "name": "AI Agent (Extracts the Journal Entry)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -360,
        -80
      ]
    },
    {
      "id": "98a146e5-3af8-4b0a-9ec6-28b34144a52e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -600
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "3079fb79-026c-45c6-9a12-96d6c94e3b5d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        -180
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "50f32072-45e2-49e7-88f6-a3d5e7f0dc9e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        580
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent (Extracts the Journal Entry)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent (Extracts the Journal Entry)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Unique Trade ID": {
      "main": [
        [
          {
            "node": "Log The Trade In Google Sheets Journal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If (Trade Found => True)": {
      "main": [
        [
          {
            "node": "Existing Entry Update OR New Entry",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Agent Handles (If Trade Is Not Found)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent (Extracts the Journal Entry)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Agent Handles (If Trade Is Not Found)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract Journal Entry Fields": {
      "main": [
        [
          {
            "node": "If (Trade Found => True)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Existing Entry Update OR New Entry": {
      "main": [
        [
          {
            "node": "Update the Sheet With Profit & Loss",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Unique Trade ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update the Sheet With Profit & Loss": {
      "main": [
        [
          {
            "node": "Send Response Back",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent (Extracts the Journal Entry)": {
      "main": [
        [
          {
            "node": "Extract Journal Entry Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent Handles (If Trade Is Not Found)": {
      "main": [
        [
          {
            "node": "Sends Response Back To Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log The Trade In Google Sheets Journal": {
      "main": [
        [
          {
            "node": "Send Trade ID to Telegram For Further Updates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}