# AI Crop Advisory for Farmers

**Category:** Agriculture  
**Tools:** OpenAI, Google Sheets, n8n  
**Nodes:** 27  
**Built by:** Forgent Systems

Gives farmers practical, AI-generated crop advice based on their soil, crop and live weather. Advice is delivered instantly on sign-up and refreshed daily over WhatsApp.

![Workflow](preview.webp)

## How it works

1. A farmer submits crop, soil and location details through a form.
2. Live weather is fetched and simple soil and market rules are applied.
3. An AI advisor writes a short, actionable recommendation.
4. The record is saved to Google Sheets and the advice is sent on WhatsApp.
5. A daily schedule repeats the analysis for every registered farmer.

## Use cases

- Farm cooperatives and growers' associations
- Agronomy advisory services
- Rural outreach programs

## Data setup

**Google Sheets** (tab: columns)

- **Smart Farming Data → Sheet1**: `Farmer Name`, `Phone Number`, `Crop`, `Location`, `Temperature`, `Humidity`, `Advice`, `Market Price`, `Trend`, `Selling Advice`, `Date`

## Setup

1. In n8n open **Workflows → Import from File** and choose `workflow.json`.
2. Connect these credentials:
   - Google Sheets account
   - OpenAI account
   - Twilio account
3. Point the Sheets / Airtable / Drive / Slack nodes at your own resources (structure above).
4. Replace placeholder emails, phone numbers and `YOUR-FORM-ID` links with your own.
5. Times use the America/New_York timezone and dates use MM/DD/YYYY. Adjust if needed.
6. Run a test execution, then activate.

## Nodes

- **OpenAI Chat Model** — `@n8n/n8n-nodes-langchain.lmChatOpenAi`
- **Simple Memory** — `@n8n/n8n-nodes-langchain.memoryBufferWindow`
- **Farmer Input Form Trigger** — `n8n-nodes-base.formTrigger`
- **Format Farmer Data** — `n8n-nodes-base.set`
- **Fetch Weather Data** — `n8n-nodes-base.httpRequest`
- **Soil Analysis Logic** — `n8n-nodes-base.code`
- **AI Farming Advisor** — `@n8n/n8n-nodes-langchain.agent`
- **AI Response Formatter** — `@n8n/n8n-nodes-langchain.outputParserStructured`
- **Market Decision Logic** — `n8n-nodes-base.code`
- **Generate Farmer Message** — `n8n-nodes-base.code`
- **Store Farmer Data** — `n8n-nodes-base.googleSheets`
- **Send WhatsApp Alert** — `n8n-nodes-base.twilio`
- **Loop Over Items** — `n8n-nodes-base.splitInBatches`
- **OpenAI Chat Model1** — `@n8n/n8n-nodes-langchain.lmChatOpenAi`
- **Simple Memory1** — `@n8n/n8n-nodes-langchain.memoryBufferWindow`
- **Daily Scheduler** — `n8n-nodes-base.scheduleTrigger`
- **Get Farmers Data** — `n8n-nodes-base.googleSheets`
- **Fetch Weather** — `n8n-nodes-base.httpRequest`
- **Soil Analysis** — `n8n-nodes-base.code`
- **Farming Advisor** — `@n8n/n8n-nodes-langchain.agent`
- **Market Decision** — `n8n-nodes-base.code`
- **WhatsApp Alert** — `n8n-nodes-base.twilio`
- **Generate Message** — `n8n-nodes-base.code`
- **Response Formatter** — `@n8n/n8n-nodes-langchain.outputParserStructured`
- **Sticky Note** — `n8n-nodes-base.stickyNote`
- **Sticky Note1** — `n8n-nodes-base.stickyNote`
- **Sticky Note2** — `n8n-nodes-base.stickyNote`
