EKSNEKS
Tutorial

Building a document-intake pipeline with Claude.

From inbox attachment to structured CRM record — a working pattern for automated document extraction with human review.

By EKSNEKS Engineering July 2026 12 min read Claude · n8n · Tutorial

Document intake is the highest-ROI automation we build: invoices, forms and contracts arrive as attachments, and someone re-types them into a system. This tutorial shows the pattern we deploy, simplified for clarity.

The pipeline has five stages: capture (watch a mailbox), classify (what kind of document is this?), extract (pull structured fields), validate (check against business rules), and review (a human approves anything below a confidence threshold).

The architecture

n8n orchestrates the flow; Claude handles classification and extraction. The critical design choice is making extraction return structured JSON with an explicit confidence score per field — never free text.

// Extraction prompt (simplified)
const prompt = `Extract from this invoice:
- vendor_name, invoice_number
- total_amount, currency, due_date
Return JSON. For each field include
"value" and "confidence" (0-1).
Use null when a field is not present.`;

// Validation gate
if (fields.total_amount.confidence < 0.9) {
  await queueForHumanReview(doc, fields);
}

The confidence gate is what makes this production-safe. High-confidence documents flow straight to the CRM; anything uncertain lands in a review queue where a human confirms or corrects in seconds — and every correction becomes a test case.

Note

Never let extracted data write to a system of record without either a confidence threshold or a human gate. The failure mode isn’t missing data — it’s confidently wrong data.

The extraction step

To adapt this pattern to your own documents:

  • Start with one document type — invoices are the classic first win.
  • Define the field schema and validation rules before prompting.
  • Log every extraction with its confidence for later evaluation.
  • Review the queue weekly at first; thresholds tune themselves with data.

This pipeline typically ships in 3–4 weeks including the review UI, and pays for itself in re-typing time within months. The same skeleton handles forms, contracts and reports — only the schema changes.

About EKSNEKS

We're a software engineering company building AI systems, custom software and cloud infrastructure. Articles like this come from real client work — anonymized and generalized.