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.
How it runs
The automated pipeline, trigger to output.
- TriggerInbound email with PO attachmentGmail
- ActionSplit + extract header and line items (OpenAI)OpenAI
- LogicNormalize fields, reject records missing PO number
- OutputInsert header + line rows into Postgres stagingPostgres
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
- 1An inbound email with a PDF or image attachment to the monitored mailbox triggers the run.
- 2OpenAI splits the attachment if it contains multiple POs and extracts header plus line-item fields for each.
- 3A logic step normalizes units, dates, and currency and rejects records missing a PO number.
- 4The flow inserts one row into the `po_header` staging table and one row per line into `po_line`, linked by PO id.
- 5Rows are marked `pending_import` for the downstream ERP loader to claim.
Set it up
What you configure once, before turning it on.
- 1Connect GmailRead, draft, send, label.
- 2Connect OpenAIModels, embeddings, files.
- 3Connect PostgresAny Postgres URL — query, write, migrate.
- 4Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
- 5Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
- 6Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.
More Document Ops workflows
Narrate new Dropbox PDFs into MP3 audio versions
When a PDF lands in a watched Dropbox folder, extract its text and generate an ElevenLabs voice narration.
On-demand PDF narration via webhook with emailed audio link
Accepts a PDF URL through a webhook, generates an ElevenLabs narration with the requested voice, stores the MP3, and emails the requester a download link.
Triage emailed contract redlines and route by risk
When a counterparty emails a redlined contract, extracts the attachment, diffs clauses against approved templates.
Batch-narrate a Google Drive PDF folder in multiple languages
On a schedule, finds PDFs in a Google Drive folder that lack audio, then generates ElevenLabs narrations in each configured language and files them into per-language subfolders…
Executed Contract Exhibit & Initials Completeness Gate
When a signed contract lands in a Dropbox intake folder, verify every required exhibit, schedule, and initialed page is present.
Draft a negotiation brief from contract clause deviations
An agent reviews a contract against approved templates, researches each deviation.
Run it inside a business
This workflow drops into a full company template. Import the org, and this is one of the playbooks its agents run.

Run this workflow in your colony.
14-day trial. No DevOps. No Sales call. Provisioned in under a minute.
