The problem
A Thai small business pays suppliers and site expenses by bank transfer, and the slips pile up in LINE chats until someone keys the amounts into the books at month end. Typing from a slip is slow and error prone: a wrong digit, a Buddhist Era date read as a Western one, the same transfer entered twice, or the expense booked against the wrong project.
Architecture
- Channel
- LINE expense bot
- Slip photo in the chat
- Agent
- Gemini reads the slip
- Field checks in code
- Tools
- Supabase expense records
- Model key in Supabase Vault
- Human
- Staff confirm the amount
- Staff pick category, project
Where the data stays: Slip photos and expenses stay in your own Supabase; a compressed copy of each slip goes to the model provider to be read.
Design flow
- Staff send a slip photo to the LINE bot
- Gemini reads amount, date, payee, reference
- Code checks each field, converts the BE year
- Reference saved before: duplicate warningOnly sometimes
- Staff confirm, pick category, press saveHuman checkpoint
Setup
Total time: 4 h 10 min our estimate
- 20 min
The free tier has a daily quota and its terms may let Google use the images, names and account numbers included: for real supplier slips use a paid tier, check in your plan.
Done when: The settings card shows the slip reader as on with only the key's last four characters, and the test button answers that the key works.
- 1 h 30 min
Done when: A real transfer slip sent to the bot comes back with amount, date, payee and reference, and a confirm button showing the amount read.
- 1 h
Done when: Unit tests pass for a zero amount, a Buddhist Era date, a future date, a date older than 400 days and a reference with odd characters.
- 30 min
Done when: Sending the same slip again after saving shows a duplicate warning, and staff can still save if it is a real second payment.
- 30 min
Done when: Nothing is saved until staff confirm or retype the amount, pick category and project and press save; a project named in the slip note is first among the buttons, not selected.
- 20 min
Done when: With the key cleared, the quota used up or a photo that is not a slip, the bot asks for the amount by hand and says why.
Ticks are saved on this browser.
Starter prompt
Written from how the use case works and its sources. Replace the parts in square brackets.
You read Thai bank transfer slips for an expense bot. From the attached slip image return only a JSON object with amount (number, Thai baht), date (YYYY-MM-DD, convert a Buddhist Era year by subtracting 543), payee (the recipient name as printed) and reference (the transaction reference, letters, digits, underscores and hyphens only). If a field is not readable, return null for it and never guess. Do not add any other text. The user will confirm or correct the amount and choose the category and project before anything is saved.
Risks and data
Data
A slip shows the payee's name and often a masked account number, which is personal data when the supplier is a sole trader. Keep the model key in the vault, limit the bot to staff accounts, and read the model's data terms first: the source's own settings card warns that Google's free tier may use submitted images, including names and account numbers.
How it goes wrong
One digit read wrong becomes a wrong cost that nobody notices. The confirm button shows the amount read so staff compare it with the slip, the parser drops impossible amounts and dates, and the duplicate warning catches a slip sent twice. When the quota runs out the bot quietly falls back to typing, so watch how many slips are keyed by hand each month.
How the agent works
It starts
Staff key expenses through the company's LINE bot.
The agent works
When a user sends a slip photo, the bot stores the photo and, if no amount was typed, sends a compressed copy of the image to Gemini, which returns the amount, date, payee and reference number. That result is a proposal, not an entry: the bot shows a confirm button with the amount it read, or the user types a different amount. A parsing step checks every field before it is shown, so the amount must be above zero and within a ceiling, a Buddhist Era year is converted, a date in the future or older than 400 days is dropped, and the reference may contain only letters, digits, underscores and hyphens. If that reference was already saved, the bot warns but does not block. The user then picks the category and the project (a project named in the slip's note is placed first among the buttons, never selected for them) and presses save; nothing is saved without that press. If the key is missing, the free quota is used up, the key is invalid or the slip cannot be read, the bot falls back to asking for the amount by hand and says why.
The result
The Gemini key sits in Supabase Vault and is managed on a settings card with save, test and off.
Worked example
ห้างหุ้นส่วนจำกัด รวยแน่ (Ruaynae Limited Partnership) runs its own income and expense recording system, whose login page names the partnership and asks for a project head, an owner, an email and a PIN. Its public GitHub repository merged the slip reading feature, labelled R24, on 31 October 2026 (pull request 44, 'read slips with AI in the expense entry bot'). The pull request names gemini-3.5-flash-lite with gemini-flash-lite-latest as the fallback, a seven case unit test suite for the parser, a test plan covering unit tests, database checks, the settings card and the LINE scenarios, and a settings card that warns the user that Google may use submitted images to improve its services. The source reports no time saved or error counts, so measure your own: slips keyed by hand per month before and after, and corrections found at month end.
The slip reading is one vision model call, so Claude or an OpenAI model can take Gemini's place in a build like this. The LINE bot, the field checks, the duplicate warning and the confirmation card are the company's own code and come with no vendor; the source used Gemini's free tier, which is why the bot has a fallback for an exhausted quota.
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/ruaynae/ruaynae/pull/44
- https://github.com/ruaynae/ruaynae
- https://ruaynae.vercel.app
Published: 2026-11-03