From Receipt to GL Code in 3 Seconds: Inside EngageCentral's Pipeline on AWS
Here is what happens in the three seconds between a staff member uploading a receipt via WhatsApp and the resulting expense line hitting the correct GL code in your accounting system.
Second 0: Upload
The staff member snaps a photo of a crumpled Grab taxi receipt on their phone. They forward it to their company's ReimburseMe WhatsApp number. Their phone compresses the image to ~800KB and sends it. Our WhatsApp ingestion endpoint receives the payload, checks the sender's phone number against the customer's authorised list, and writes the image to S3 at incoming/{customer-id}/{receipt-id}.jpg.
Time elapsed: ~400ms (mostly network).
Second 1: Classification and OCR start
An S3 PutObject event triggers an EventBridge rule. EventBridge invokes an AWS Step Functions state machine. The first state fires Amazon Bedrock Claude Haiku with the raw image bytes. Prompt: "Is this a receipt, an invoice, or something else? Reply with one word." Haiku responds in ~200ms with "receipt".
In parallel, the next state has already invoked Amazon Textract's AnalyzeDocument API in synchronous mode with the Tables + Forms features enabled. Textract processes the image, extracts text, identifies key-value pairs, and returns structured output. For a typical phone-photo receipt (medium quality, English, printed), this takes 700-1,400ms.
Time elapsed: ~1.5s cumulative.
Second 2: Structured extraction
The Textract output flows into the next state. Amazon Bedrock Claude Sonnet is invoked with the extracted text, the detected key-value pairs, and a receipt-specific extraction prompt:
Extract from this receipt:
- merchant: the business name (e.g., "Grab", "Deliveroo", "Toast Box")
- amount: the final total paid (decimal number)
- currency: ISO 4217 code (SGD, MYR, IDR, THB, etc.)
- date: ISO 8601 date (YYYY-MM-DD)
- category: one of [transport, meals, accommodation, office, other]
- tax_amount: GST/VAT/service charge if shown separately
- payment_method: cash | card | paynow | ewallet | other
Return JSON only. If a field is unclear, set it to null.Claude Sonnet reads the context and returns structured JSON in 800-1,500ms. For our Grab receipt example:
{
"merchant": "Grab",
"amount": 24.50,
"currency": "SGD",
"date": "2026-12-04",
"category": "transport",
"tax_amount": null,
"payment_method": "paynow"
}Time elapsed: ~2.5-3s cumulative.
Second 3: Validation and GL coding
Two things happen in parallel:
Validation. A deterministic rules engine checks: amount parses as a positive decimal; currency is a valid ISO 4217 code and matches one of the customer's configured currencies; date is not in the future and not older than the customer's configured retention window (typically 90 days); category is in the allowed set.
GL coding. The customer configured a mapping of categories to GL codes during onboarding: transport → 6230 (Travel Expense), meals → 6210 (Staff Meals), etc. The pipeline looks up the GL code based on the category. For customers with more complex rules (e.g., meals during business travel vs daily meals), a second Claude Haiku call applies the customer-specific routing logic.
Final sanity check. Claude Haiku is called with the raw Textract text, the extracted JSON, and the proposed GL code. Prompt: "Does this extraction and GL code look right? Flag any concerns." If it flags, the record goes to a human review queue instead of auto-posting.
Time elapsed: ~3s cumulative.
Second 3+: Post and notify
The validated record is written to S3 (processed/{customer-id}/{expense-id}.json). An EventBridge event fires. The customer's downstream integration receives the webhook:
- For Xero customers, the record is pushed to Xero as a new draft expense claim line
- For Zoho Books customers, same flow via the Zoho API
- For customers on PeopleCentral or custom accounting stacks, the record is delivered via REST webhook or scheduled file export
- For accounting systems we do not natively integrate with, the record is written to a customer-accessible S3 bucket for their own ingestion
Meanwhile, the staff member who uploaded the receipt gets a WhatsApp confirmation: "Got it. Grab, S$24.50, 4 Dec, posted to Travel. Reply CHANGE if that's wrong."
Total time from photo upload to GL-coded record in the accounting system: 3-5 seconds in the fast path. Up to 30 seconds in the slow path when a document is large, multi-page, or needs re-processing.
What makes it fast
Three design decisions compound to produce the 3-second number.
Parallel orchestration. Classification, OCR, and the first validation checks run in parallel where their inputs do not depend on each other. Step Functions handles this cleanly.
Model routing. Haiku for cheap-and-fast decisions, Sonnet for complex extraction. We default to Haiku and escalate only when the first-pass output signals complexity.
Single-region. The whole pipeline runs in ap-southeast-1 (AWS Singapore). No inter-region hops. For APAC customers this means median end-to-end latency under 5 seconds from most countries.
Why not just one giant model call?
A single-call "here's an image, give me structured JSON" approach works but has three problems:
- Cost. Running everything through Sonnet is ~10x more expensive than running Haiku for routing and only using Sonnet where needed.
- Reliability. Each specialised step has clear inputs, outputs, and failure modes. A single call hides failures in the LLM output.
- Observability. We can measure accuracy, latency, and cost per step. When extraction accuracy drops, we know whether it was OCR, extraction prompt, validation, or integration.
What this looks like at scale
A typical ReimburseMe customer processes 500-5,000 receipts per month. At the top of that range (5,000/month), the AWS consumption cost comes to:
| Service | Cost per month |
|---|---|
| Amazon Textract | ~$180 |
| Amazon Bedrock (Claude Haiku + Sonnet) | ~$60 |
| S3, Step Functions, EventBridge | ~$15 |
| Total AWS cost | ~$255/month |
At 50,000 receipts per month, costs scale roughly linearly to ~$2,500/month. Compare to a traditional per-document IDP vendor at $0.50-$1.00 per receipt: $25,000-$50,000/month at the same volume.
Where it still breaks
Three categories of edge cases need human review:
- Crumpled low-light phone photos where Textract cannot extract text reliably. We ask the user to retake the photo.
- Receipts in less-common APAC languages (Lao, Khmer, Burmese) where Textract support is weaker. Processing still works via Bedrock's language capability, but accuracy is lower and we route to human review.
- Hand-written notes on the receipt (common when a user adds their own project code or client name). Handled with a dedicated extraction pass that focuses on the non-printed areas.
The point
The pipeline is engineering, not magic. The individual pieces (OCR, LLM extraction, validation, workflow) are well-understood. The engineering problem is composing them so the whole thing runs reliably, cheaply, and in under 5 seconds for a random Grab receipt uploaded from an iPhone in Bukit Timah.
If you want to see this running end-to-end on your own documents, we offer a 30-minute live demo. Bring 10-20 of your actual receipts or invoices and we process them live in the session.
Related reading
- Intelligent Document Processing on AWS: Textract + Bedrock Architecture
- Amazon Bedrock vs Textract for IDP: When to Use Each
- WhatsApp + AI: How Field Teams in Singapore Submit Expenses Without an App
About EngageCentral: Engage Central Pte Ltd (UEN 202432974N) is a Singapore-incorporated AI document intelligence company. We build productized SaaS (ReimburseMe, HireCentral) and custom document automation solutions on Amazon Bedrock and Textract, hosted in AWS Asia Pacific (Singapore).
Ready when you are.
Related reading
Intelligent Document Processing on AWS: Textract + Bedrock Architecture
/information/guides/aws-idp-architecture/
Amazon Bedrock vs Textract for IDP: When to Use Each
/blog/bedrock-vs-textract-when-to-use-each/
WhatsApp + AI: How Field Teams in Singapore Submit Expenses Without an App
/blog/whatsapp-expense-submission/