{"product_id":"n8n-workflow-route-planning-daily-gmail-dispatch-with-osrm","title":"n8n Workflow: Route Planning \u0026 Daily Gmail Dispatch with OSRM","description":"\u003ch3\u003ePlan the shortest daily driving route and email it to your technician—automatically\u003c\/h3\u003e\n\u003cp\u003eThis 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.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns every morning (Mon–Sat) via cron\u003c\/strong\u003e to start planning the day’s route.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReads the Google Sheets “Visits” tab\u003c\/strong\u003e and keeps only rows scheduled for \u003cem\u003etoday\u003c\/em\u003e with \u003cstrong\u003evalid latitude\/longitude\u003c\/strong\u003e, excluding visits marked \u003cstrong\u003edone\u003c\/strong\u003e or \u003cstrong\u003ecancelled\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFetches real driving-time estimates with OSRM\u003c\/strong\u003e using an OSRM Table API request (depot → all stops).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFallback behavior:\u003c\/strong\u003e if OSRM is unavailable, it estimates travel time using \u003cstrong\u003estraight-line time\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOptimizes the route sequence\u003c\/strong\u003e with a \u003cstrong\u003enearest-neighbor pass\u003c\/strong\u003e followed by \u003cstrong\u003e2‑opt improvements\u003c\/strong\u003e, while respecting any visits pinned as \u003cstrong\u003efirst\u003c\/strong\u003e or \u003cstrong\u003elast\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCalculates chained ETAs\u003c\/strong\u003e, departure times from the configured day start, adds \u003cstrong\u003ebuffers\u003c\/strong\u003e and \u003cstrong\u003evisit durations\u003c\/strong\u003e, and flags any stop that pushes the schedule past end-of-day.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWrites results back to Google Sheets\u003c\/strong\u003e by appending\/updating the numbered route in the “Routes” tab.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSends an email via Gmail\u003c\/strong\u003e to the technician containing the HTML run sheet.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTelegram dispatch alert\u003c\/strong\u003e triggers \u003cem\u003eonly\u003c\/em\u003e when the route overruns working hours.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eDaily route planning for field technicians who must follow an optimized visit order with accurate arrival times.\u003c\/li\u003e\n  \u003cli\u003eOperations teams who want automatic scheduling from live Google Sheets data and proactive escalation when the day runs late.\u003c\/li\u003e\n  \u003cli\u003eSmall service businesses using n8n to connect \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e, \u003cstrong\u003eOSRM\u003c\/strong\u003e, and \u003cstrong\u003eGmail\/Telegram\u003c\/strong\u003e without custom back-end development.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n nodes\/integrations:\u003c\/strong\u003e \u003ccode\u003ecron\u003c\/code\u003e scheduling, \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003egmail\u003c\/code\u003e, \u003ccode\u003esplit out\u003c\/code\u003e, \u003ccode\u003etelegram\u003c\/code\u003e, and \u003ccode\u003esticky note\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eData model:\u003c\/strong\u003e Google Sheets “Visits” (visit_id, visit_date, lat, lng, duration_minutes, pin, status, contact\/job fields) and “Routes” (route output columns).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCore optimization:\u003c\/strong\u003e OSRM Table API drive-time matrix + nearest-neighbor + 2‑opt, with pinned stops preserved.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46228905590963,"sku":"N8N-20871","price":9.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/DhAkFkZqgp7rlDTw_PIne_bmj67DEV.png?v=1792056417","url":"https:\/\/buyflowscripts.com\/products\/n8n-workflow-route-planning-daily-gmail-dispatch-with-osrm","provider":"N8N Commerce","version":"1.0","type":"link"}