Automate Invoice Processing with OCR, GPT-4 & Salesforce Opportunity Creation — Workflow n8n

Średnia złożoność Wyzwalacz11 węzłów🏷️ Invoice Processing👁 4 wyświetleńautor: Le Nguyen

Przegląd

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 Purpose**: Fire when a new file appears in a specific Google Drive folder. Key settings**: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output**

Użyte węzły

HTTP RequestGoogle DriveMicrosoft OneDriveSalesforceCodeOpenAI

Podgląd workflow

PDF Invoice Extractor (AI) to Salesforce Oppo
What it does:
Watch a Drive folder → OCR PDF → extract invoices (JSON
1) Google Drive Trigger
- Op: fileCreated in folder (ID)
- Poll: every minute
- Creds: Google Drive OAuth2
- Note: Ensure access/Shared Drive rights
2) Download from Drive
- Op: download by {{$json.id}}
- Binary key: data (default)
- Creds: Google Drive OAuth2
3) Extract from File
- Op: pdf (enable OCR for scans)
- Output: {{$json.text}}
4) Message a Model (JSON)
- Node: @n8n/n8n-nodes-langchain.openAi
- Model: gpt-4.1 (or gpt-4.1-mini)
- Prompt: strict schema; return only JSON array
- jsonOutput: true
- Output path (first item
5) Salesforce: Upsert Account (Buyer)
- Node: salesforce (account upsert)
- External Id: tax_id__c
- externalIdValue: ={{ $json.message.content.buyer.tax_
- name: ={{ $json.message.content.buy
6) Salesforce: Create Opportunity
- Node: salesforce (resource: opportunity)
- name: ={{ $('Message a model').item.json.message.cont
- closeDate: ={{ $('Message a model').item.js
7) Code: Build SOQL (PricebookEntry)
- Node: Code (JS)
- Purpose: collect ProductCodes from LLM products → bui
- Output: { soql, codes }
8) Salesforce: Query PricebookEntries
- Node: salesforce (search)
- query: ={{ $json.soql }}
9) Code: Build OLI Payloads
- Node: Code (JS)
- Inputs:
- OpportunityId: ={{ $('Create an opportunity').first
- Lines: ={{ $('Message a model').first().json.messag
10) HTTP Request: Create Opportunity Line Ite
- Method: POST
- URL: https://<your-instance>.my.salesforce.com/servic
- Auth: salesforceOAuth2Api
- Body (JSON): ={{
11) Upload to OneDrive
- Op: upload
- Name: ={{ $json.name }}
- Parent Folder ID: (set)
- Binary: from step 2
- Creds: OneDrive OAuth2
E
Extract from File
G
Google Drive Trigger
Message a model
Download File From Google
Update File to One Drive
Create an opportunity
Create or update an acco…
Build SOQL
Query PricebookEntries
Code in JavaScript
Create Opportunity Line …
11 nodes10 edges

Jak to działa

  1. 1

    Wyzwalacz

    Workflow uruchamia się wyzwalaczem wyzwalacz.

  2. 2

    Przetwarzanie

    Dane przepływają przez 11 węzłów, connecting code, extractfromfile, googledrive.

  3. 3

    Wyjście

    Workflow kończy automatyzację i dostarcza wynik do skonfigurowanego miejsca docelowego.

Szczegóły węzłów (11)

HT

HTTP Request

httpRequest

#1
GO

Google Drive

googleDrive

#2
MI

Microsoft OneDrive

microsoftOneDrive

#3
SA

Salesforce

salesforce

#4
CO

Code

code

#5
OP

OpenAI

n8n-nodes-langchain.openAi

#6

Jak zaimportować ten workflow

  1. 1Kliknij przycisk Pobierz JSON po prawej stronie, aby zapisać plik workflow.
  2. 2Otwórz swoją instancję n8n. Przejdź do Workflow → Nowy → Importuj z pliku.
  3. 3Wybierz pobrany plik automate-invoice-processing-with-ocr-gpt-4-salesforce-opportunity-creation i kliknij Importuj.
  4. 4Skonfiguruj dane uwierzytelniające dla każdego węzła usługi (klucze API, OAuth itp.).
  5. 5Kliknij Testuj workflow, aby sprawdzić, czy wszystko działa, a następnie aktywuj go.

Lub wklej bezpośrednio w n8n → Importuj z JSON:

{ "name": "Automate Invoice Processing with OCR, GPT-4 & Salesforce Opportunity Creation", "nodes": [...], ...}

Integracje

codeextractfromfilegoogledrivegoogledrivetriggerhttprequestmicrosoftonedriveopenaisalesforce

Pobierz ten workflow

Pobierz i zaimportuj jednym kliknięciem

Pobierz JSONZobacz na n8n.io
Węzły11
Złożonośćmedium
Wyzwalacztrigger
Wyświetlenia4

Autor

Le Nguyen

Le Nguyen

@leeseifer

Tagi

codeextractfromfilegoogledrivegoogledrivetriggerhttprequestmicrosoftonedriveopenaisalesforce

Nowy w n8n?

n8n to darmowe narzędzie open-source do automatyzacji workflow. Hostuj samodzielnie lub użyj wersji chmurowej.

Pobierz n8n za darmo →

Related Invoice Processing Workflows

COCOEMEX+5
medium

Automate Custom QuickBooks Invoice PDFs & Email with n8n

Standard accounting templates often fail to reflect a premium brand identity. This sophisticated n8n workflow bridges the gap between financial record-keeping and professional client presentation. By moving beyond the native limitations of QuickBooks Online, this automation enables businesses to generate high-end, multi-page PDF invoices that align perfectly with their corporate styling. The process begins the moment a new invoice is generated in QuickBooks, triggering a webhook that captures real-time billing data. The workflow then utilizes advanced HTML-to-File conversion and custom Code nodes to structure data into a polished, branded layout. It handles complex logic such as line-item merging and multi-page formatting automatically. Once the document is rendered, the system bypasses generic 'no-reply' senders by routing the finalized PDF through your preferred email provider. This ensures a seamless, white-labeled experience for your clients while eliminating the manual overhead of exporting, styling, and attaching files. Ideal for agencies and service providers, this flow guarantees that your most frequent touchpoint—the bill—is as professional as your work. **Common Use Cases:** - High-end creative agencies requiring bespoke, white-labeled billing documents for premium clients. - Automated recurring subscription billing where custom tax disclosures or localized branding are required. - Service-based businesses needing to attach dynamic project reports or terms of service directly to QuickBooks invoices.

🔗 Webhook·12 nodes