Younes El HamriData engineering · MoroccoAvailable 5 days/week

Invoicing from seven days to under four hours

Client
Delivery company (anonymised)
Sector
Transport & logistics
Delivered
Delivered at AMSKAR
Period
2021
Stack
Azure Functions, Azure Document Intelligence, OpenCV, Python, WhatsApp Business API
Invoicing cycle~7 daysunder 4 hours
Delivery notes40–60 a day, now read automatically
Back-office manual workroughly halved
Problem

Drivers collected signed paper delivery notes all week and dropped them at the office. A clerk retyped 40 to 60 of them a day into the ERP, so nothing could be invoiced until the paperwork caught up. That was about a week of cash-flow delay, every week.

What I did

Drivers photograph the signed note and send it over WhatsApp Business. An Azure Function queues the job, OpenCV cleans up the phone photo, Document Intelligence turns it into structured JSON, and a Python validation engine checks the client and the line items before it becomes a draft invoice in the ERP. Anything that fails validation goes to a review queue instead.

Capture where the document is created

The obvious fix is a scanner at the office. That does not help: the week is lost on the road, not at the desk. So capture moved to the driver: a photo of the signed note, sent over WhatsApp Business, which is the one app every driver already had and nobody had to be trained on.

The pipeline

A webhook lands on an Azure Function, which queues the job. OpenCV makes a phone photo readable: deskew, crop, contrast. Document Intelligence turns it into structured JSON. A Python validation engine then checks the things an invoice gets rejected for: does this client exist, do the line items add up, is this a duplicate of yesterday’s note.

Valid documents become draft invoices in the ERP. Everything else goes to a review queue.

Two decisions that carried it

Serverless, deliberately. Document traffic is spiky: a burst in the morning, then quiet. Paying per execution rather than for an idle VM matched the shape of the load.

The exception path stays human. The machine does the ninety percent that is mechanical; the back office spends its time on the ten percent that needs judgement. That is why the clerk’s workload fell by about 70% instead of the work simply moving somewhere else.