DOCUMENT OPS

Extract line items from emailed PO scans into Postgres

Triggers on inbound emails carrying scanned PO attachments, splits multi-PO attachments, extracts line items with OpenAI.

CategoryDocument Ops
Enginesim
Difficultyintermediate
Triggerevent
Steps4
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerInbound email with PO attachmentGmailGmail
  • ActionSplit + extract header and line items (OpenAI)OpenAI
  • LogicNormalize fields, reject records missing PO number
  • OutputInsert header + line rows into Postgres stagingPostgreSQLPostgres

What it does

Captures purchase orders that arrive as email attachments, parses each scanned PO into structured header and line records, and inserts them into a Postgres staging schema your ERP or downstream job can pull from.

When to use it

Use it when vendors email scanned or faxed POs to a shared inbox and you need them landed in a relational store rather than a spreadsheet — for example as a staging layer ahead of an ERP or warehouse import.

How it works

  1. 1An inbound email with a PDF or image attachment to the monitored mailbox triggers the run.
  2. 2OpenAI splits the attachment if it contains multiple POs and extracts header plus line-item fields for each.
  3. 3A logic step normalizes units, dates, and currency and rejects records missing a PO number.
  4. 4The flow inserts one row into the `po_header` staging table and one row per line into `po_line`, linked by PO id.
  5. 5Rows are marked `pending_import` for the downstream ERP loader to claim.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect GmailRead, draft, send, label.
  2. 2
    Connect OpenAIModels, embeddings, files.
  3. 3
    Connect PostgresAny Postgres URL — query, write, migrate.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.