Case study ยท AI in daily use
A bot that turns invoice photos into purchase orders
I built it for a liquor retailer with seven stores and a warehouse. Staff post a photo of each vendor invoice, the bot lists every line and checks the math, and a manager taps approve. Then the bot creates the purchase order in Lightspeed, the store's inventory system, so nobody types invoices in by hand.
The real bot is private to the store, so below you can watch it work on a made-up invoice, one step at a time.
How it works
-
A photo goes into the team chat
When a delivery arrives, someone at the warehouse takes a photo of the invoice and posts it in the team's channel on Discord, a free group chat app. They did this before the bot existed, so their day did not change at all.
A made-up food distributor invoice, so no real business's prices are shown.
-
The bot lists every line
The bot sends the photo to Claude, an AI model that reads images, and posts a draft as a reply under the photo. Each line shows the item code, the product, the quantity, the price and the line total, and the fees are listed on their own.
Invoice BotAPPThis is the real bot's reading of the photo above, and every line matches the paper.
-
The bot checks the math
Before anyone approves, the bot adds the lines and the fees and compares the sum with the total printed on the invoice. When they match, the draft stays green.
When they are off by more than 2%, the draft turns yellow and shows the gap, because a gap almost always means a number was misread. Tap the second button to see one.
12 lines$2,002.70Fees$39.50Bot's sum$2,042.20Printed total$2,042.20They match, so the draft stays green.
12 lines$1,802.70Fees$39.50Bot's sum$1,842.20Printed total$2,042.20Off by $200.00, so the draft turns yellow.
A made-up misread: the salmon price lost its first digit. The warning's wording is the bot's own.
-
A manager approves, or fixes a line in plain words
Nothing reaches the inventory system until a manager approves it. If one line is wrong, the manager replies under the draft the way they would text a coworker, and the bot corrects that line.
If the whole invoice is wrong, a thumbs-down stops it, and the office enters it the usual way.
Manageronly got 2 cases of the chickenInvoice BotAPPโ Line 1 (Chicken Breast, Boneless, 4/10...) qty โ 2.0 (total now $192.80)๐ 1๐The reply and the bot's answer are real output from the bot.
-
The bot creates the purchase order in Lightspeed
On approval, the bot matches each line to the store's product list in Lightspeed and creates the purchase order through Lightspeed's API, its built-in connection for other software. At the liquor store it also turns cases into bottles, because vendors bill by the case and the store counts bottles.
Any line it cannot match is listed for a person to add, so nothing goes in on a guess.
Invoice BotAPPโณ Approved by Manager โ submitting 12 items to Lightspeed (est. ~0m 36s)...The bot's real message format. The order number is an example, because this made-up invoice never went to a real store.
The 98%, explained
Managers approve 98% of invoices exactly as the bot first read them.
That is the share approved with no line changed. The rest get a one-line fix in a reply, or a thumbs-down sends them back to the office. Either way, a person signs off on every invoice before anything is entered.
Checks built in
- Manager sign-off. Nothing is entered until a manager taps approve.
- Math check. Lines plus fees must match the printed total within 2%, or the draft turns yellow and shows the gap.
- Duplicate check. If the same invoice is posted twice, the bot says when it was first processed and asks before entering it again.
- Not-final warning. If an invoice is marked Not Final, the bot says to wait for the final copy.
- Learns product names. After each approval it saves how that vendor names each product, so "BLANT BBN" and "BLANTONS" both land on the same bottle next time.
What I did
- Put it where the work was. The bot lives in the channel where the photos already went.
- Tested eight ways to read a photo. I tried three text-scanning tools, alone and mixed with AI, and kept the simplest way, which was also the most accurate.
- Built the checks. I wrote the math check, the duplicate check and the approval step.
- Connected Lightspeed. I used its API to match products and create purchase orders.
- Shipped it and kept it running. I built it end to end and changed it as the store's staff used it.
Built with: Python ยท Discord ยท Claude vision ยท Postgres ยท Lightspeed Retail API ยท Railway
What I learned
Put the AI where the work already happens. The warehouse team was already posting invoice photos in Discord, so the bot lives in that same channel. Nobody had to learn a new app, and that is why it gets used.
Simple beat clever. My early versions ran each photo through a separate text-scanning tool before the AI saw it. Then the person testing it at the store put the same photo into a plain AI chat tool, and it came back perfect. So I cut the extra step, sent the photo straight to the AI model, and the readings got better.
Want to talk?
I'm Raj Lakhani. I build AI tools that real staff use every day, and I would like to build them for your team.