{
  "id": "VJLi9bYDwoxoDD9e",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Identify plants from a photo and get a care schedule with Gemini and Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "da1f858d-f2ea-4a42-90c4-3a0ebf855cb7",
      "name": "Plant Photo Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        144,
        48
      ],
      "parameters": {
        "options": {
          "buttonLabel": "Identify my plant",
          "respondWithOptions": {
            "values": {
              "formSubmittedText": "Thanks! Your plant report will arrive by email shortly."
            }
          }
        },
        "formTitle": "Identify my plant",
        "formFields": {
          "values": [
            {
              "fieldType": "email",
              "fieldLabel": "Your email",
              "requiredField": true
            },
            {
              "fieldLabel": "Nickname",
              "placeholder": "e.g. Kitchen fern",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Location",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Bright direct sun"
                  },
                  {
                    "option": "Bright indirect light"
                  },
                  {
                    "option": "Low light"
                  },
                  {
                    "option": "Outdoors"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "file",
              "fieldLabel": "Plant photo",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": ".jpg,.jpeg,.png"
            }
          ]
        },
        "formDescription": "Upload a photo of your plant to identify it, check its health and get a watering and care schedule."
      },
      "typeVersion": 2.6
    },
    {
      "id": "f75528e9-cdc3-43f0-b268-b8b2452e1fd3",
      "name": "Identify Plant with Gemini",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueErrorOutput",
      "position": [
        544,
        48
      ],
      "parameters": {
        "text": "=You are a botanist and houseplant expert. Look at the plant photo and identify it. The owner keeps it in: {{ $json.Location }}. Give the common and scientific name, how confident you are, whether the plant looks healthy, sick or dying, any visible problems such as yellowing, pests, root rot or sunburn, a concrete watering instruction, the light it needs, practical care tips, how many days between waterings as a number, and whether it is toxic to cats and dogs. If it is not a plant, say so in common_name and set confidence to low.",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "imageDetail": "high",
              "messageType": "imageBinary",
              "binaryImageDataKey": "Plant_photo"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "fbd389c7-12c4-485d-b3ab-d75c1cb29bea",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        512,
        256
      ],
      "parameters": {
        "options": {
          "temperature": 0.2
        },
        "modelName": "models/gemini-3.1-flash-lite"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "43b68ad5-4b37-458b-8c80-dd7163dcf590",
      "name": "Plant Report Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        720,
        256
      ],
      "parameters": {
        "jsonSchemaExample": "{\"common_name\":\"Boston fern\",\"scientific_name\":\"Nephrolepis exaltata\",\"confidence\":\"high\",\"health\":\"healthy\",\"problems\":[\"Slight leaf browning at tips\"],\"watering\":\"Water every 3-4 days, keep soil lightly moist\",\"light\":\"Bright indirect light\",\"care_tips\":[\"Mist regularly\",\"Repot each spring\"],\"water_every_days\":4,\"toxic_to_pets\":true}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "124d6d34-d51e-457f-b6d3-27158fb5a236",
      "name": "Parse Plant Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        32
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const src = $json.output || $json;\nconst f = $('Plant Photo Form').item.json;\nconst bullets = function (x) { return Array.isArray(x) ? x.map(function (i) { return '- ' + i; }).join('\\n') : (x || ''); };\nconst join = function (x) { return Array.isArray(x) ? x.join('; ') : (x || ''); };\nconst days = Number(src.water_every_days) || 7;\nconst next = new Date(Date.now() + days * 86400000).toISOString().slice(0, 10);\nreturn {\n  email: f['Your email'] || '',\n  nickname: f.Nickname || '',\n  location: f.Location || '',\n  commonName: src.common_name || 'Unknown',\n  scientificName: src.scientific_name || '',\n  confidence: String(src.confidence || 'low').toLowerCase(),\n  health: String(src.health || 'healthy').toLowerCase(),\n  problems: join(src.problems),\n  problemList: bullets(src.problems),\n  watering: src.watering || '',\n  light: src.light || '',\n  careTips: bullets(src.care_tips),\n  waterEveryDays: days,\n  nextWatering: next,\n  toxicToPets: src.toxic_to_pets ? 'Yes' : 'No'\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "28a2ffb0-fda9-4e67-8d86-fd2793bda53a",
      "name": "Log Plant to Care Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1424,
        32
      ],
      "parameters": {
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Plants"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select your spreadsheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "67fc0842-f29a-4aae-9bbd-460fa05e25f7",
      "name": "Route by Plant Health",
      "type": "n8n-nodes-base.switch",
      "position": [
        1792,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $(\"Parse Plant Report\").item.json.health }}",
                    "rightValue": "dying"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $(\"Parse Plant Report\").item.json.health }}",
                    "rightValue": "sick"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $(\"Parse Plant Report\").item.json.health }}",
                    "rightValue": "healthy"
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Other"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "db5d05be-397c-426b-981b-f2134889befb",
      "name": "Email Rescue Plan",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2048,
        -16
      ],
      "parameters": {
        "sendTo": "={{ $(\"Parse Plant Report\").item.json.email }}",
        "message": "={{ \"Your \" + $(\"Parse Plant Report\").item.json.commonName + \" (\" + $(\"Parse Plant Report\").item.json.scientificName + \") is in serious trouble.\\n\\nWhat I can see:\\n\" + $(\"Parse Plant Report\").item.json.problemList + \"\\n\\nAct now:\\n\" + $(\"Parse Plant Report\").item.json.careTips + \"\\n\\nWatering: \" + $(\"Parse Plant Report\").item.json.watering + \"\\nLight: \" + $(\"Parse Plant Report\").item.json.light }}",
        "options": {},
        "subject": "={{ \"Urgent: \" + $(\"Parse Plant Report\").item.json.nickname + \" needs help\" }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c97b555e-9660-4eb9-b2df-769fcbc173f6",
      "name": "Email Treatment Plan",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2048,
        144
      ],
      "parameters": {
        "sendTo": "={{ $(\"Parse Plant Report\").item.json.email }}",
        "message": "={{ \"Your plant is a \" + $(\"Parse Plant Report\").item.json.commonName + \" and it is showing early problems.\\n\\nProblems spotted:\\n\" + $(\"Parse Plant Report\").item.json.problemList + \"\\n\\nHow to fix it:\\n\" + $(\"Parse Plant Report\").item.json.careTips + \"\\n\\nWatering: \" + $(\"Parse Plant Report\").item.json.watering + \"\\nNext watering: \" + $(\"Parse Plant Report\").item.json.nextWatering }}",
        "options": {},
        "subject": "={{ $(\"Parse Plant Report\").item.json.nickname + \" has a problem worth fixing\" }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "82e5423f-e3a2-48ef-92de-636faa41a26e",
      "name": "Email Care Schedule",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2048,
        304
      ],
      "parameters": {
        "sendTo": "={{ $(\"Parse Plant Report\").item.json.email }}",
        "message": "={{ \"Identified as \" + $(\"Parse Plant Report\").item.json.commonName + \" (\" + $(\"Parse Plant Report\").item.json.scientificName + \"), confidence \" + $(\"Parse Plant Report\").item.json.confidence + \".\\n\\nYour plant looks healthy.\\n\\nWatering: \" + $(\"Parse Plant Report\").item.json.watering + \"\\nNext watering: \" + $(\"Parse Plant Report\").item.json.nextWatering + \"\\nLight: \" + $(\"Parse Plant Report\").item.json.light + \"\\nToxic to pets: \" + $(\"Parse Plant Report\").item.json.toxicToPets + \"\\n\\nCare tips:\\n\" + $(\"Parse Plant Report\").item.json.careTips }}",
        "options": {},
        "subject": "={{ $(\"Parse Plant Report\").item.json.nickname + \" is a \" + $(\"Parse Plant Report\").item.json.commonName }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "aeb35a59-568e-477b-af0f-fc0e157a8516",
      "name": "Email Unclear Result",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2048,
        464
      ],
      "parameters": {
        "sendTo": "={{ $(\"Parse Plant Report\").item.json.email }}",
        "message": "={{ \"Our best guess is \" + $(\"Parse Plant Report\").item.json.commonName + \", but confidence is \" + $(\"Parse Plant Report\").item.json.confidence + \".\\n\\nTry another photo showing the whole plant and a close-up of a leaf.\\n\\nGeneral guidance:\\n\" + $(\"Parse Plant Report\").item.json.careTips }}",
        "options": {},
        "subject": "We could not confidently identify your plant",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "25e8b127-9af2-42a1-8332-92395ea30b67",
      "name": "Email Identification Failure",
      "type": "n8n-nodes-base.gmail",
      "position": [
        928,
        224
      ],
      "parameters": {
        "sendTo": "={{ $(\"Plant Photo Form\").item.json[\"Your email\"] }}",
        "message": "Sorry - we could not read your photo. Please try again with a clear, well-lit picture showing the leaves.",
        "options": {},
        "subject": "We could not identify your plant",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f5cee64b-92b6-456a-9206-00f1365102a5",
      "name": "Overview Sticky",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -288
      ],
      "parameters": {
        "width": 440,
        "height": 804,
        "content": "## Identify plants from a photo and get a care schedule with Gemini and Google Sheets\n\n### How it works\nPeople kill houseplants because they never learn what they actually bought. Photograph the plant, submit it through the built-in n8n form with where you keep it, and a Basic LLM Chain with Google Gemini reads the image directly - identifying the common and scientific name, judging whether it looks healthy, sick or dying, spotting problems like yellowing, pests or root rot, and returning a watering interval, light needs, care tips and whether it is toxic to cats and dogs. The plant is upserted into a Google Sheets care log by nickname with the next watering date calculated, and a Switch sends a different email: a rescue plan for dying plants, a treatment plan for sick ones, a care schedule for healthy ones.\n\n### Setup\n1. Connect Google Gemini (PaLM) API, Google Sheets and Gmail.\n2. Point the Sheets node at your spreadsheet (tab: Plants).\n3. Open the form URL on your phone and photograph a plant.\n\n### Customization tips\nAdd a scheduled watering reminder that reads the Next Watering column."
      },
      "typeVersion": 1
    },
    {
      "id": "b07d369f-dac8-4cfe-a6c0-14f250937e05",
      "name": "S1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 428,
        "height": 900,
        "content": "## 1. Photograph the plant\nThe built-in n8n form takes the nickname, where the plant lives and the photo. Nothing else to install."
      },
      "typeVersion": 1
    },
    {
      "id": "35da39ac-6f33-4433-99c6-c6f4b527fdf8",
      "name": "S2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 644,
        "height": 900,
        "content": "## 2. AI identification (Basic LLM Chain)\nGemini reads the photo directly and returns species, health, problems and care needs as JSON. Unreadable photos email the owner."
      },
      "typeVersion": 1
    },
    {
      "id": "89dc5620-a187-4c41-858e-92c8b38c31e7",
      "name": "S3",
      "type": "n8n-nodes-base.stickyNote",
      "disabled": true,
      "position": [
        1104,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 564,
        "height": 900,
        "content": "## 3. Build the care log\nCalculate the next watering date and upsert the plant by nickname, so re-photographing the same plant updates its row instead of duplicating it."
      },
      "typeVersion": 1
    },
    {
      "id": "5ddc9496-11bc-469e-a702-9d4219f2e951",
      "name": "S4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 584,
        "height": 900,
        "content": "## 4. Route by health\nDying plants get an urgent rescue plan, sick plants get a treatment plan, healthy plants get the care schedule, unclear results ask for a better photo."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "dc26bc25-3b52-40ea-89ce-133133c024f6",
  "nodeGroups": [],
  "connections": {
    "Plant Photo Form": {
      "main": [
        [
          {
            "node": "Identify Plant with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Plant Report": {
      "main": [
        [
          {
            "node": "Log Plant to Care Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Plant Report Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Identify Plant with Gemini",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Route by Plant Health": {
      "main": [
        [
          {
            "node": "Email Rescue Plan",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Treatment Plan",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Care Schedule",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Unclear Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Plant to Care Sheet": {
      "main": [
        [
          {
            "node": "Route by Plant Health",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Identify Plant with Gemini",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Identify Plant with Gemini": {
      "main": [
        [
          {
            "node": "Parse Plant Report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Identification Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}