Turn forwarded business document images into structured records with gpt-5.6-terra Vision, Postgres, and Gmail
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (8)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Code
n8n-nodes-base.code - Postgres
n8n-nodes-base.postgres - Gmail
n8n-nodes-base.gmail - Schedule Trigger
n8n-nodes-base.scheduleTrigger - HTTP Request
n8n-nodes-base.httpRequest
What it does
Forwarded documents, handled. This workflow takes business document photos sent to a webhook, reads them with AI vision, stores structured records in Postgres, and emails your ops team a summary. Unreadable files get flagged, open items get daily reminders. Last updated: September 2026. Quick overview This workflow accepts forwarded business document images via a webhook, uses OpenAI gpt-5.6-terra Vision to classify and extract key fields, stores the result in Postgres, and emails operations a summary or an error notice, plus a daily reminder email for any documents still marked open. How it works 1. Receives a POST webhook submission containing an image URL or base64 image along with optional metadata like document type and sender note. 2. Validates that an image is present and, if so, sends it to OpenAI gpt-5.6-terra Vision with instructions to return a structured JSON record and summary. 3. Parses the OpenAI response into normalized fields such as document type, title, summary, extracted data, amount, currency, dates, and a confidence score. 4. If the document is recognized, upserts the structured record into a Postgres bizdocuments table and emails the extracted summary to the operations inbox via Gmail. 5. If the document is missing or unrecognized, emails an “unreadable document” notice to the operations inbox via Gmail. 6. Runs daily at 08:00 (Asia/Jakarta), queries Postgres for documents not marked done and older than 24 hours, and emails a follow-up list to operations via Gmail. Setup 1. Add an OpenAI API credential for the Chat Completions endpoint and ensure the workflow can access the gpt-5.6-terra model. 2. Add a Postgres credential and create a bizdocuments table with columns used by the INSERT/UPSERT query (including a unique docid and a status field). 3. Add a Gmail OAuth2 credential, then update the recipient address in the three Gmail send steps to your operations inbox. 4. Copy the webhook URL for the docintake path and configure your intake source to POST imageurl or imagebase64 (and optional doctype, note, submitter) to it. 5. Confirm the schedule trigger timing and timezone (Asia/Jakarta) match your business hours before activating the workflow. Quick Answers What if a document can't be read? Operations gets an "unreadable document" notice by email instead of silence. How are open items chased? Every day at 08:00, documents still open after 24 hours land in a follow-up email. Where is data stored? A Postgres bizdocuments table with a unique docid per record. Additional info Built with n8n. Need an assessment on your business? Feel free to reach out at https://khmuhtadin.com/consultation/