WhatsApp

How to automate email orders into your ERP in a week (it took nine days)

An electrical wholesaler, 12 people, Comarch Optima. A sales rep took 26 minutes to retype an order from an email; the automation does it in 4 seconds. I go through it day by day, including the three things that went wrong.

Cover: Email orders to ERP in a week

An electrical wholesaler near Wrocław, 12 people, three sales reps, Comarch Optima. Orders come in by email to zamowienia@ (the orders inbox): sometimes with a PDF, sometimes as a photo of a sheet of paper, sometimes as "the same as last time, please". We timed it with a stopwatch: 26 minutes per order, from opening the email to sending the confirmation. Ten orders a day, 21 working days, that's over 90 hours a month. The owner's estimate was "a couple of hours a day". It usually comes out at twice what people think, because nobody counts switching windows and asking the customer to clarify.

BEFORE: 26 MINUTES PER ORDERClient's emailSales rep readsand queriesPrice huntin list and memoryTypes into Optima14 fields by handRepliesto clientLine by line, switching windows. 3 to 4 quantity mistakes a week.AFTER: 4 SECONDS, A HUMAN ONLY FOR EXCEPTIONSClient'semailAI reads email+ PDFChecks VAT ID,prices, duplicatesZK documentin Optima via APIConfirmation+ note on TeamsExceptions (new client, item not in price list) get a draft and wait for one click.
The same process before and after. The human stays where the automation has doubts.

What the automation actually does

  1. The zamowienia@ inbox is hooked up to n8n on the client's server. A new email kicks off the process within half a second.
  2. AI reads the body and the attachment. It pulls out the customer, the line items, quantities, delivery date and notes. With "3 of what we had last time" it does this: it looks into that customer's order history in Optima, suggests the item from the last document and marks it "to be confirmed".
  3. It checks the VAT ID against the VAT register, the delivery address, whether the items exist in the price list, and whether this isn't a duplicate from the last 48 hours.
  4. It creates a ZK (a customer order document) in Optima through the API, with the discount from the customer's card.
  5. It sends the customer a confirmation with the order number and date, and the sales rep a short note on Teams. If anything was flagged for confirmation, the rep gets a link to the document and one question.
EElektro-Bud Sp. z o.o.Order for next weekHello,please send 12 pcs YDY 3x1.5 cable,2 x white flush socket and3 pcs like last time.Delivery by Friday to site.Regards, Marekorder_0923.pdf (scan)AIZK 2026/09/0412for approvalClientElektro-Bud Sp. z o.o.VAT ID ok ✓1.YDY 3x1.5 450/750V · 12 pcsPLN 1.84/m from list2.White flush socket · 2 pcsmatched: GN-14B3.“like last time” · 3 pcsfrom 12 Sep order: 12M board?DueFri 26 Sepfrom email bodyDisc.7% (agreed)from client card in Optima!line 3 waits for sales rep
A real (lightly edited) email and what came out of it. Line three is waiting for a human.

Tip: The first version should handle the typical orders, which at this client meant 70%. Odd formats and new customers can stay with a human, but with a ready draft from the AI instead of an empty form.

What those nine days looked like

The plan was a week. The timeline below shows what was left of it.

PLAN: 7 DAYS. TOOK: 9.day 1Review of the last 30 orders7 exception types listed, incl. “like last time”day 2Access set up, first flow on a test databaseday 3First real emailsPDF scans: AI reads 60% of lines. We add OCR, a day lost.day 4Comparison with what a human entereddiscounts in the rep's head. Price list into Optima first.day 5Live start with manual approvalday 6Duplicate orderclient sent the same email twice. Duplicate check added.SaturdayAPI token expired at 3:14queue stalled for 5 hours. Token auto-renewal and a WhatsApp alert.days 8–9Approval switched off for 14 clientsthe ones that sprang no surprises all week
The three days when something broke, marked in red.

Day one was a review of the last 30 orders with the sales reps. We wrote down seven types of exceptions. Day two: access to the inbox (a separate technical account), access to the Optima API and the first flow on a test database. Up to this point everything was going to plan.

Day three: scans

The first real emails. Five out of thirty came as PDFs from the customer's system, and the AI read those without any trouble. Three came as photos of a sheet of paper on a warehouse table, complete with shadow and ballpoint pen. From those the AI pulled out about 60% of the lines. We added OCR before the model and accuracy jumped above 90%, but the day went on that instead of on comparisons. Photos of paper sheets are still flagged "to be checked", because 90% on a 40-line order means four mistakes.

30 ORDERS FROM LAST MONTH: WHAT FORM THEY CAME INPlain email text21PDF from client's system5Photo or scan of a sheet3“Like last time”1The bottom two groups: 13% of orders, 70% of the problems.
Thirty orders from one month. The bottom two groups caused most of the problems.

Day four: discounts in people's heads

We compared the documents from the automation with the ones a human had entered earlier. In 11 out of 30 the prices didn't match. The automation took prices from the price list in Optima, while the sales rep knew that "Kowalski gets 7%, we agreed on that in March". That wasn't in any system. For two days the owner and the reps moved those arrangements into the customer cards. The automation had nothing to do here; we simply couldn't move on until the pricing lived in one place. In hindsight this was the most useful part of the whole project, because along the way it turned out two customers had a discount nobody could remember the reason for.

Day six: the duplicate

First week live, with manual approval of every document. A customer sent the same email twice (once from his phone, once from his computer, because "he wasn't sure it went through"). The automation politely created two ZKs. Ania from the office caught it during approval, but since that day the automation compares every new order with documents from the last 48 hours (same customer, same items, same quantity) and holds the second one back with a question.

Saturday, 3:14 am

The Optima API token expired. The email queue stopped for five hours and nobody noticed, because it was Saturday. On Monday morning five orders were waiting in the queue. Nothing terrible, but since then the token renews itself, and if nothing goes through for 15 minutes the owner gets a WhatsApp message. That alarm has gone off once since, when the internet provider was doing work on the line.

What I needed from the client

  • access to the inbox through a separate technical account, with no need for the owner's password,
  • access to the Optima API and a test database,
  • the last 30 order emails, including the ugly ones,
  • one person who approves every document during the first week. Here it was Ania, who knows the customers by name and knows that "Kowalski" is three different companies.
AFTER FOUR WEEKS4 sinstead of 26 minper order0line item errorswas: 3–4 a week20 ha week back to the team12 people, 3 sales reps9 daysto deliverplan said 7
The numbers after four weeks.

Efekt: After a month, 86% of orders go through untouched. The sales reps got back around 20 hours a week and, as the owner puts it, "started calling people". Quantity errors: zero in four weeks, down from three or four a week. The remaining 14% are new customers and photos of paper sheets, which still get a ready draft.

Got a similar process? Let's talk, I will work out how much of it the robots can take.

What it costs

The simple variant (email, AI, ERP, confirmation) is the Start package: a few days of work. If you add stock checks, reserving goods and invoicing, it's the Firma package. With the quote you get a second number next to it: how many hours you're giving back to the team. For this wholesaler the project paid for itself in the first month, counting time alone, without the errors and without the fact that the reps started selling again.

Tomasz Stachowiak

I automate boring work in companies: I connect systems, add AI and build tools that give people their hours back. I write about what really works for clients.

30 processes you can automate in a week

Free PDF: concrete processes from six areas of a company, with the time to build and the effect.

Send me the PDF

Got a process that drives you mad?

Write two sentences about what eats the most time. I will reply with what can be automated and where to start.

Let's talk

New posts by email, once a week

One email with what I wrote this week. No "special offers", with an unsubscribe link in every message.