n8n Workflow: Route Planning & Daily Gmail Dispatch with OSRM
n8n Workflow: Route Planning & Daily Gmail Dispatch with OSRM
Regular price
£9.99
Regular price
£9.99
Sale price
Unit price
/
per
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
Couldn't load pickup availability
🔥
128+ Sold
Popular with n8n builders
⚡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
n8n Workflow: Route Planning & Daily Gmail Dispatch with OSRM
Regular price
£9.99
Regular price
£9.99
Sale price
Unit price
/
per
Plan the shortest daily driving route and email it to your technician—automatically
This n8n workflow pulls today’s visits from Google Sheets, calculates an optimized stop order using OSRM real road times, and emails an HTML run sheet with arrival/departure times. Dispatch only gets a Telegram alert if the day overruns working hours.
What this workflow does
- Runs every morning (Mon–Sat) via cron to start planning the day’s route.
- Reads the Google Sheets “Visits” tab and keeps only rows scheduled for today with valid latitude/longitude, excluding visits marked done or cancelled.
- Fetches real driving-time estimates with OSRM using an OSRM Table API request (depot → all stops).
- Fallback behavior: if OSRM is unavailable, it estimates travel time using straight-line time.
- Optimizes the route sequence with a nearest-neighbor pass followed by 2‑opt improvements, while respecting any visits pinned as first or last.
- Calculates chained ETAs, departure times from the configured day start, adds buffers and visit durations, and flags any stop that pushes the schedule past end-of-day.
- Writes results back to Google Sheets by appending/updating the numbered route in the “Routes” tab.
- Sends an email via Gmail to the technician containing the HTML run sheet.
- Telegram dispatch alert triggers only when the route overruns working hours.
Use cases
- Daily route planning for field technicians who must follow an optimized visit order with accurate arrival times.
- Operations teams who want automatic scheduling from live Google Sheets data and proactive escalation when the day runs late.
- Small service businesses using n8n to connect Google Sheets, OSRM, and Gmail/Telegram without custom back-end development.
Technical details
-
n8n nodes/integrations:
cronscheduling,if,code,gmail,split out,telegram, andsticky note. - Data model: Google Sheets “Visits” (visit_id, visit_date, lat, lng, duration_minutes, pin, status, contact/job fields) and “Routes” (route output columns).
- Core optimization: OSRM Table API drive-time matrix + nearest-neighbor + 2‑opt, with pinned stops preserved.
