An AI agent can turn LINE and email orders into ERP lines by reading each message, matching the customer and products to your ERP's own master data, and drafting the order lines. A person checks the draft against the original message and approves it; only then are the lines posted to the ERP through its API.
What the agent does, and what it does not
Our guide on getting LINE orders into your ERP compares the three ways in: an order form, an AI reader and an ERP connection. This one goes deeper into the AI route. It shows what an agent does with each message, where it has to stop and ask, and how the approved lines reach the ERP.
The agent does the reading, matching and drafting that someone on the order desk does today. It does not decide prices, invent products or post anything on its own. A person approves every order. That limit is part of the design, not a temporary safety net.
The flow, from message to ERP lines
- The message arrives. On LINE, the customer writes to your LINE Official Account, and LINE's Messaging API sends it to the agent's webhook, photos included. For email, the agent watches a shared address such as orders@ through your mail provider's API.
- The agent reads it. Text in Thai, English or both, a photo of a handwritten list, or a PDF purchase order all become one list of what the customer asked for, in their words.
- It finds the customer. A LINE user is linked to a customer code once, the first time, by a person. After that the link is stored. For email, the sender's address or domain points to the customer. If one sender orders for several branches, the agent looks for the branch in the message.
- It matches products against your ERP's master data. It uses your item list, the sales units, your list of product nicknames, and what this customer usually buys. "Mozza" for one customer may be a different item than for another, and their history settles it.
- It drafts the order lines. Each line has an item code, a quantity, a unit and a delivery date, plus a short reason and a flag when it is unsure.
- A person approves. The order desk sees the original message beside the draft, fixes what is wrong and approves. Each correction is kept.
- The lines are posted through the ERP's API. In SAP Business One that is usually the Service Layer, its REST interface. In Odoo it is the external API (XML-RPC or JSON-RPC, depending on version). The ERP returns an order number, which is stored with the message.
A worked example: one order, end to end
The data below is invented to show the mechanics. A café group (customer code C0142 in this example) writes to the LINE Official Account at 21:40: "Hi, for tomorrow pls: unsalted butter 1kg x6, cream 2 ctn, mozza 5. Sukhumvit branch. Thanks".
The LINE user is already linked to C0142, and "Sukhumvit branch" matches one of its delivery addresses. "Tomorrow" is read against the message time in Bangkok, so the delivery date is the next calendar day. The agent then checks that date against the customer's delivery days. The draft looks like this:
| Message says | Proposed item | Qty and unit | Status |
|---|---|---|---|
| unsalted butter 1kg x6 | BT-UNS-1KG, unsalted butter 1 kg | 6 pieces | Matched |
| cream 2 ctn | CR-35-1L, cooking cream 35% 1 L | 2 cartons (12 × 1 L each) | Matched, unit converted |
| mozza 5 | MZ-2KG, shredded mozzarella 2 kg | 5 bags? | Check: two mozzarella items, no unit |
For the third line, the agent saw two candidates: a 125 g fresh mozzarella and a 2 kg shredded bag. This customer's recent orders are all the 2 kg bag, so it proposes that, but the message gives no unit, so it flags the line instead of guessing quietly. The person on the desk confirms 5 bags and approves.
The agent then creates the order in the ERP. In SAP Business One, that is one call to the Service Layer's Orders endpoint with the customer code, the delivery date and three lines of item code and quantity. It sends no prices. The ERP applies the customer's own price list, as it would for an order typed by hand. The order number comes back and is saved next to the LINE message.
When the agent should stop and ask
- Unknown product. Nothing in the item list, the nicknames or the customer's history fits. The line is left open with the customer's exact words, and the person picks the item. That choice becomes a new nickname.
- Ambiguous quantity or unit. "5" with no unit, "a box" for an item sold by the piece, or a photo where a digit is unclear. The agent shows its best reading and marks it. A wrong unit is the most expensive mistake on the list, so it never fills one in silently.
- Price check. If the message mentions a price ("same price as last time", "฿120 as agreed"), the agent compares it with the price the ERP will apply. If they differ, the order goes to someone who can decide. It never writes the customer's price into the order.
- Unknown sender or new branch. The first message from a new LINE user or email address waits for a person to link it to a customer.
- Changes and duplicates. "Add 2 more butter" twenty minutes later should amend the open order, not create a second one. The same PDF sent twice should be caught.
What the agent needs from your ERP
Mostly what your order desk already relies on: a clean item list with sales units, the customer list with delivery addresses, and price lists that are kept up to date in the ERP. It also needs an API user with only the rights to read master data and create orders. If you are on SAP Business One, check your licences for that user with your SAP partner. If item codes or units are inconsistent today, the agent will reproduce that mess faster. Fix the data first.
What we'd do first
- Collect a few weeks of real orders as they arrived: chats, photos, PDFs, with the ERP order each became.
- Run the agent on that sample with no connection to the ERP, and compare its drafts line by line with what the desk actually keyed in. Count the flags and the misses.
- Write the nickname list and the unit rules from what that comparison shows.
- Go live with a person approving, posting to the ERP as draft documents or into a test company first, then as real orders once the desk trusts it.
You get a measured answer on your own orders before committing to a build.
When not to do this
- A handful of orders a day. A person who knows the customers is quicker and cheaper than any agent.
- Customers already order through EDI or a portal. Those orders are already structured; connect them directly.
- Master data you would not trust a new hire with. Clean it first. That work pays off with or without AI.
- An ERP with no API and no import route. The agent can draft, but someone will still retype. Solve the connection first.
- Nobody can own the approval step. Without a person approving, this is not a design we would build.
Where this fits: this guide connects to AI implementation and ERP integration. Also see the three ways to get LINE orders into your ERP.