REF / AUTOMATION

Lahore Couriers - AI Dispatch and Customer Comms for a 60-Rider Fleet

Automated order routing, driver dispatch, customer SMS, and exception handling for a regional courier company - cut cost-per-delivery by 31%.

RoleAutomation Lead
Year2025
Outcome−31% cost per delivery
DomainAutomation
00
STACK

Tech used.

PythonOR-Toolsn8nTwilioGoogle Maps APIPostgreSQLTelegram

The Problem

A 60-rider last-mile courier company in Lahore was assigning deliveries by spreadsheet. every morning, two dispatchers sat with the day's orders and manually grouped them into rider routes. Customer notifications were sent by hand from a single SIM. Exception handling (failed delivery, address change, RTO requests) lived in a WhatsApp group with 80+ messages a day that everyone scrolled past.

Cost per delivery was creeping up. Customer complaints about late or missing deliveries were the #1 churn driver. The owner had spent two years quoting six-figure logistics platforms that promised the world and would have eaten his margin.

What I Built

A purpose-built automation stack that fit the company's actual workflow:

  1. Morning dispatch optimiser: a Python service using OR-Tools (Google's optimisation library) that ingests the day's orders + rider availability + zone constraints and generates optimal routes in under 90 seconds. Replaces 3 hours of dispatcher work.
  2. Rider mobile flow: Telegram bot that pushes each rider their daily route, accepts proof-of-delivery photos, and updates order status in real time.
  3. Customer comms layer: Twilio-driven SMS at three checkpoints (picked up, out for delivery, delivered) plus a WhatsApp template for failed-delivery rescheduling.
  4. Exception triage: a Claude-powered classifier reads incoming WhatsApp queries, extracts the order number, looks up status, and either auto-replies or escalates to the right human.
Daily Dispatch Looporders → 60 riders → customer
  1. 01
    TriggerDay's orders ingested

    All inbound orders + rider availability + zone constraints loaded into the dispatch service each morning.

  2. 02
    StepOR-Tools generates routes

    Optimisation library produces optimal multi-stop routes across the 60-rider fleet.

    3 hours → 90 seconds
  3. 03
    StepTelegram bot pushes to riders

    Each rider receives their daily route, captures proof-of-delivery photos, and updates order status in real time.

  4. 04
    StepCustomer SMS at 3 checkpoints

    Twilio fires picked-up, out-for-delivery, and delivered messages. Failed deliveries trigger a WhatsApp rescheduling template.

  5. 05
    DecisionException triage

    Inbound WhatsApp queries classified by Claude: order lookup, status reply, or escalation to the right human.

  6. 06
    OutputDay closed in dashboard

    Performance per rider and per zone surfaces for the next morning's planning. PKR 142 → PKR 98 cost per delivery.

Cost per Delivery (PKR)Aug 2024. Sep 2025 · automation phased in M3-M6
Aug
142
Oct
148
Dec
138
Feb
124
Apr
108
Jun
102
Aug
96
Sep
98
−31%
Cost per delivery
PKR 142 → 98
+22%
Daily deliveries per rider
−68%
Dispatcher hours/week
120 → 38
94%
Customer SMS delivered

Outcome

Within 6 months, the company absorbed a 40% volume increase with the same headcount, dropped one dispatcher position into customer service, and re-priced their B2B contracts more competitively because their unit economics had improved. The owner's main feedback: "I stopped opening the dispatch WhatsApp group at 7am."