# Delivery Route Optimization & Driver Dispatch

**Category:** Logistics  
**Tools:** n8n, Airtable, Slack  
**Nodes:** 22  
**Built by:** Forgent Systems

Groups today's ready orders into routes, picks an available truck, calculates distance and time, checks the weather on the route and sends the driver a WhatsApp brief with a map link.

![Workflow](preview.webp)

## How it works

1. On schedule, orders ready for delivery are read from Airtable.
2. Orders are grouped and an available truck is found, and the team is alerted if none is free.
3. Route distance, duration and a map link are generated.
4. Weather along the route is summarized.
5. The driver gets a WhatsApp message and the records are updated.

## Use cases

- Distribution and FMCG delivery
- Local logistics fleets
- Construction material suppliers

## Data setup

**Airtable** (table: fields)

- **Route & Load Optimization → Orders**: `Order ID`, `Status`
- **Route & Load Optimization → Fleet**: `Truck ID`, `Availability`
- **Route & Load Optimization → RoutesOutput**: `Order ID`, `Route ID`, `Date`, `Truck ID`, `Driver Name`, `Driver Phone`, `Total Weight kg`, `Total Stops`, `Est Total km`, `Est Total Time Min`, `Weather Summary`, `Route Link`

## Setup

1. In n8n open **Workflows → Import from File** and choose `workflow.json`.
2. Connect these credentials:
   - Airtable account
   - OpenWeatherMap account
   - Slack 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

- **Sticky Note** — `n8n-nodes-base.stickyNote`
- **Grouped Route** — `n8n-nodes-base.code`
- **Get Route Details** — `n8n-nodes-base.code`
- **Split Order IDs** — `n8n-nodes-base.code`
- **Schedule Trigger** — `n8n-nodes-base.scheduleTrigger`
- **Get Today Ready For Delivery Records** — `n8n-nodes-base.airtable`
- **Loop Over Delivery Records** — `n8n-nodes-base.splitInBatches`
- **Generate Formula** — `n8n-nodes-base.code`
- **Get Available Truck** — `n8n-nodes-base.airtable`
- **If Check Truck Availability** — `n8n-nodes-base.if`
- **Alert to Team for truck not available** — `n8n-nodes-base.slack`
- **Get Google Maps Route** — `n8n-nodes-base.httpRequest`
- **Find a Distance & Duration** — `n8n-nodes-base.httpRequest`
- **Generate Route Link** — `n8n-nodes-base.code`
- **Search Route Weather** — `n8n-nodes-base.openWeatherMap`
- **Generate Weather Summary** — `n8n-nodes-base.code`
- **Generate Whatsapp Message & Payload** — `n8n-nodes-base.code`
- **Send WhatsApp to Driver Notify** — `n8n-nodes-base.twilio`
- **Notify to Supplier Team** — `n8n-nodes-base.slack`
- **Append Payload Data** — `n8n-nodes-base.airtable`
- **Update Order Status** — `n8n-nodes-base.airtable`
- **Update Truck Status** — `n8n-nodes-base.airtable`
