Problem
A production fleet management system tracked transport costs well, but its documents, invoices and customer messages still required people to produce them outside the system. Every invoice, update and scanned paper added a manual step.
Business Context
The operation runs on a production business system with the transport management app at its centre. Invoices must satisfy ZATCA e-invoicing requirements, and customers receive updates over WhatsApp.
Constraints
- Invoices must meet ZATCA Phase 2 compliance: UBL 2.1 XML, ECDSA signing and the clearance flow.
- WhatsApp is the customer channel and must stay the channel.
- Documents arrive as scanned paper and must enter the system, not sit in a folder.
- Everything generated or sent must be traceable inside the system.
Analysis
Tracing one invoice through the operation exposed three separate manual steps: generating the compliant XML, delivering it, and capturing the paper that feeds the process. Each one was fragile and none left a usable audit trail.
Architecture
The same bench hosts the transport app, the ERP layer, the e-invoicing integration, the WhatsApp bot and the OCR scanner. A shared document pipeline produces, signs, clears and delivers — with each step logged against its business record.
Solution
E-invoicing runs through a ZATCA integration (UBL 2.1 generation, ECDSA signing, clearance). Customer communication runs through the WhatsApp bot. Scanned documents enter through the OCR scanner. Kashf printing is wired to the same records.
Technology
- Production business operations platform
- ZATCA integration — UBL 2.1 XML, ECDSA signing, clearance API
- WhatsApp automation for outbound communication
- OCR scanner for document ingestion
- document print module
- secure database and task queues
Implementation
The e-invoicing engine was selected first (a pure-Python, MIT-licensed engine over Java alternatives), then integrated, then verified against live invoices before the WhatsApp and OCR layers were added.
Challenges
Compliance is not a plugin — signing, clearance failures and XML structure all needed explicit handling. WhatsApp delivery states and OCR misreads each needed a defined behaviour instead of silent failure.
Outcome
Compliant e-invoices are generated, signed and cleared from the system; documents and updates reach customers through WhatsApp; scanned paper enters the workflow. The operation's documents now come from the system itself.
Lessons
Compliance and communication are pipelines, not plugins. When they run inside the business system — with logging and retries — they become features the operation can trust instead of chores it performs.
Future Improvements
A verification layer for unusual invoice states and higher-confidence OCR routing for the document types that still need human review.