🧾 Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation

⚑ 1,347 views · 🧾 Invoice Processing

Description

PDF Invoice Extractor (AI)

End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive.


Node by node (what it does & key setup)

1) Google Drive Trigger


2) Download File From Google


3) Extract from File


4) Message a model (AI JSON Extractor)


5) Create or update an account (Salesforce)


6) Create an opportunity (Salesforce)


7) Build SOQL (Code / JS)


8) Query PricebookEntries (Salesforce)


9) Code in JavaScript (Build OLI payloads)


10) Create Opportunity Line Items (HTTP Request)


11) Update File to One Drive


Data flow (wiring)

  1. Google Drive Trigger β†’ Download File From Google
  2. Download File From Google
    • β†’ Extract from File
    • β†’ Update File to One Drive
  3. Extract from File β†’ Message a model
  4. Message a model
    • β†’ Create or update an account
  5. Create or update an account β†’ Create an opportunity
  6. Create an opportunity β†’ Build SOQL
  7. Build SOQL β†’ Query PricebookEntries
  8. Query PricebookEntries β†’ Code in JavaScript
  9. Code in JavaScript β†’ Create Opportunity Line Items

Quick setup checklist


Notes & best practices

πŸ”— Nodes Used

HTTP Request, Google Drive, Microsoft OneDrive, Salesforce, Google Drive Trigger, Extract from File

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup