Automate Invoice Processing with OCR, GPT-4 & Salesforce Opportunity Creation — рабочий процесс n8n

Средняя сложность Триггер11 узлов🏷️ Invoice Processing👁 4 просмотровот Le Nguyen

Обзор

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**

Использованные узлы

HTTP RequestGoogle DriveMicrosoft OneDriveSalesforceCodeOpenAI

Предпросмотр рабочего процесса

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

Как это работает

  1. 1

    Триггер

    Рабочий процесс запускается триггером триггер.

  2. 2

    Обработка

    Данные проходят через 11 узлов, connecting code, extractfromfile, googledrive.

  3. 3

    Вывод

    Рабочий процесс завершает автоматизацию и доставляет результат в настроенное место назначения.

Детали узлов (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

Как импортировать этот рабочий процесс

  1. 1Нажмите кнопку Скачать JSON справа, чтобы сохранить файл рабочего процесса.
  2. 2Откройте ваш экземпляр n8n. Перейдите в Рабочие процессы → Новый → Импорт из файла.
  3. 3Выберите скачанный файл automate-invoice-processing-with-ocr-gpt-4-salesforce-opportunity-creation и нажмите Импортировать.
  4. 4Настройте учётные данные для каждого узла сервиса (ключи API, OAuth и т.д.).
  5. 5Нажмите Протестировать рабочий процесс, чтобы убедиться в правильной работе, затем активируйте его.

Или вставьте напрямую в n8n → Импорт из JSON:

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

Интеграции

codeextractfromfilegoogledrivegoogledrivetriggerhttprequestmicrosoftonedriveopenaisalesforce

Получить этот рабочий процесс

Скачайте и импортируйте одним кликом

Скачать JSONПросмотреть на n8n.io
Узлы11
Сложностьmedium
Триггерtrigger
Просмотры4
КатегорияInvoice Processing

Создан

Le Nguyen

Le Nguyen

@leeseifer

Теги

codeextractfromfilegoogledrivegoogledrivetriggerhttprequestmicrosoftonedriveopenaisalesforce

Новичок в n8n?

n8n — бесплатный инструмент автоматизации рабочих процессов с открытым исходным кодом. Разверните самостоятельно или используйте облачную версию.

Получить n8n бесплатно →

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