The problem
In a Thai shop or small company the receipts and tax invoices arrive as photos on LINE from whoever paid: a driver, a cook, the owner's spouse. Someone types the seller, the tax ID, the date in Buddhist era and the VAT into a sheet weeks later, and a wrong digit in the tax ID or a VAT line that does not add up only shows when the accountant prepares the monthly VAT return.
Architecture
- Channel
- Receipt photo on the LINE OA
- Agent
- Claude structured output
- Checks in code, review flag
- Tools
- n8n workflow
- Google Sheets Receipts tab
- LINE reply
- Human
- Bookkeeper opens flagged rows
Where the data stays: The photo goes from LINE through your n8n instance to the model and the row lands in your own sheet; the agent books nothing and files no return, the bookkeeper does that from the sheet.
Design flow
- Staff send the receipt photo to the LINE OA
- Claude transcribes the fields into fixed JSON
- Code checks tax ID, date, VAT and totals
- Mismatch? Row flagged needs reviewOnly sometimes
- Row added to the sheet, LINE reply to the sender
- Bookkeeper checks flagged rows before bookingHuman checkpoint
Setup
Total time: 3 h 5 min our estimate
- 45 min
The README says the packages are not on npm yet: build from source and run the pack script to create local tarballs.
Done when: The repository builds on Node 22 or newer, the local tarballs exist, the thai-receipt node appears in your n8n, and your Anthropic API key is set as a credential.
- 30 min
Done when: The example workflow is imported, the LINE Messaging credential, the Google Sheets credential and the spreadsheet URL replace the placeholders, and the webhook URL is set on your LINE OA.
- 30 min
Done when: Ten rows land in the Receipts tab, each LINE reply says saved or saved but review, and you have compared every row with its photo.
- 20 min
Done when: It is written down which flags block a booking (tax ID checksum, VAT mismatch) and which only need a glance, and who clears a flagged row.
- 1 h
Done when: You have a count of rows right, flagged correctly and wrong without a flag for one month, because the author says live accuracy is not measured yet.
Ticks are saved on this browser.
Starter prompt
Written from how the use case works and its sources. Replace the parts in square brackets.
Read this photo of a Thai receipt or tax invoice and return only JSON with these fields: seller_name, seller_tax_id, document_number, date_as_printed, date_iso, line_items (description, quantity, unit_price, amount), subtotal, discount, vat_amount, total, amount_in_words. Transcribe what is printed; do not calculate or correct anything, and use null for a field you cannot read. I will check the tax ID checksum, the Buddhist era date, quantity times price, the 7% VAT and the totals in my own code and flag any mismatch for [the bookkeeper] to review before it is booked.
Risks and data
Data
Receipt photos carry the buyer's and seller's tax IDs and sometimes names and addresses, and they pass through LINE, your n8n instance and the model provider. Limit the LINE OA to staff, keep the sheet with the books, and read the provider's data terms; the author's sample data is synthetic, yours is not.
How it goes wrong
A blurry photo, a thermal receipt that faded, or a handwritten invoice gives a confident but wrong transcription, and the checks catch only what does not add up: a wrong seller name or a wrong date that is still a valid date passes. The author says live accuracy is not measured; you notice when flagged rows pile up or a row disagrees with its photo, so compare every row for the first month and keep the booking decision with the bookkeeper.
How the agent works
It starts
Staff send the photo of the receipt or tax invoice to the shop's LINE Official Account.
The agent works
An n8n workflow catches the message, passes only images on, downloads the file and sends it to Claude with a fixed JSON schema (Claude's structured outputs), so the model only transcribes: seller, date, line items, subtotal, discount, VAT, total, tax ID and the amount in words. Plain code then checks what the model read: the 13 digit tax ID checksum (dashes and Thai digits accepted), the Buddhist era date converted to a normal date, quantity times price, the 7% VAT both inclusive and exclusive, the totals and the amount in words; any mismatch sets a needs review flag with reasons. The workflow appends a row to the Receipts sheet (date, seller, tax ID, document number, subtotal, VAT, total, items, needs review, reasons) and replies on LINE: saved, or saved but please review, with the reasons and the seller, date and total.
The result
The bookkeeper works from the sheet, opens the flagged rows against the photo, and only then books them or files the tax invoice for the input VAT claim.
Worked example
This is a practitioner build, not a customer story: the open source repository thai-receipt-ai by the Thai developer Yuttakarn (GitHub, MIT licence, all four commits on 20 November 2026, co-authored with Claude). One TypeScript core reads photos and PDFs of Thai receipts and tax invoices with Claude structured output (claude-opus-5-5 by default) and deterministic code checks what the model read: the 13 digit tax ID checksum, Buddhist era dates, quantity times price, the 7% VAT inclusive and exclusive, the totals and the amount in words, with a needs review flag and reasons on any mismatch. It ships as a library, an MCP server with six tools (extract_receipt, check_receipt, validate_tax_id, parse_thai_date, promptpay_qr, baht_text) and an n8n node with an example workflow, LINE receipt photo to Google Sheets: LINE webhook, image check, content download, extract, append a row, reply on LINE with บันทึกใบเสร็จแล้ว or บันทึกแล้ว แต่ควรตรวจสอบ plus the reasons. The README is candid: the eval set is 32 synthetic receipts across 12 fictional shop types with 4 deliberately wrong trap receipts, live model accuracy is not measured yet, a full live run is estimated at USD 1 to 2, and the packages are built from source because they are not on npm yet. No business is named as running it; treat it as a starting point you test on your own receipts.
The extraction library, the MCP server and the n8n node in this build are written on Claude's structured outputs, which Anthropic's docs describe as responses constrained to your JSON schema; the checks are plain code that does not depend on the model. Another model means rewriting the extraction step and the n8n node yourself, so no alternative is listed. The LINE part uses a community LINE Messaging node package for n8n for the webhook, the content download and the reply.
Join the Agent OS Club
Get hours back with a team of AI agents for every department, set up step by step for the tools you use, with a person answering your questions. Founding member price: USD 14.95 a month or USD 150 a year, locked for as long as you stay. Cancel any time.
Founding offer, ends 31 December 2026 or at member 100
Join the Agent OS ClubBuilding this for an organization? Learn more at theagentiv.com
Sources
- https://github.com/Yuttakarn2545/thai-receipt-ai
- https://raw.githubusercontent.com/Yuttakarn2545/thai-receipt-ai/main/README.md
- https://raw.githubusercontent.com/Yuttakarn2545/thai-receipt-ai/main/examples/n8n/line-receipt-to-sheets.json
- https://platform.claude.com/docs/en/build-with-claude/structured-outputs
Published: 2026-11-22