# Freight Document Generation & Validation

**Category:** Logistics  
**Tools:** Google Drive, OpenAI, Google Sheets  
**Nodes:** 18  
**Built by:** Forgent Systems

Validates new shipment entries with AI, generates the freight document as a PDF, stores it in Drive and emails it to both shipper and receiver. Mismatches are flagged before anything goes out.

![Workflow](preview.webp)

## How it works

1. A new shipment row in Google Sheets starts the workflow.
2. AI checks the shipment details against carrier information.
3. If something doesn't match, the issue is emailed and the row is marked.
4. Valid shipments get a PDF document, uploaded to Drive.
5. The PDF is sent to sender and receiver and the sheet is updated.

## Use cases

- Freight forwarders
- 3PL and courier companies
- Export and import desks

## Data setup

**Google Sheets** (tab: columns)

- **Freight Documentation → Sheet1**: _(columns as used in the nodes)_
- **Freight Documentation → Shipping Details**: `Shipment ID / Reference Number`, `State`, `Drive_link`
- **Freight Documentation → Carrier Details**: `Status`

## Setup

1. In n8n open **Workflows → Import from File** and choose `workflow.json`.
2. Connect these credentials:
   - Gmail account
   - Google Drive account
   - Google Sheets Trigger account
   - Google Sheets account
   - OpenAI 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

- **Google Sheets Trigger** — `n8n-nodes-base.googleSheetsTrigger`
- **Loop Over Items** — `n8n-nodes-base.splitInBatches`
- **OpenAI Chat Model** — `@n8n/n8n-nodes-langchain.lmChatOpenAi`
- **Structured Output Parser** — `@n8n/n8n-nodes-langchain.outputParserStructured`
- **Send Shipment PDF To Sender** — `n8n-nodes-base.gmail`
- **Send Shipment PDF To Receiver** — `n8n-nodes-base.gmail`
- **Get PDF** — `n8n-nodes-base.extractFromFile`
- **PDF Generate** — `n8n-nodes-base.httpRequest`
- **Set Shipment Data** — `n8n-nodes-base.code`
- **If Validate** — `n8n-nodes-base.if`
- **Send Mismatch Items Details** — `n8n-nodes-base.gmail`
- **Update State** — `n8n-nodes-base.googleSheets`
- **Append or update row in sheet** — `n8n-nodes-base.googleSheets`
- **Validate Shipment details** — `@n8n/n8n-nodes-langchain.agent`
- **Sticky Note** — `n8n-nodes-base.stickyNote`
- **Upload file** — `n8n-nodes-base.googleDrive`
- **Download File** — `n8n-nodes-base.httpRequest`
- **Carrier Details** — `n8n-nodes-base.googleSheetsTool`
