Use this powerful n8n workflow to automatically process PDF invoices using GPT-4 for data extraction, creating corresponding Accounts, Opportunities, and Line Items in Salesforce.
Download this n8n workflow template and start using it instantly.
• Sales Operations teams needing to automate B2B invoice processing.
• Financial controllers seeking to log incoming supplier or client invoices directly into their CRM.
• n8n users looking for advanced examples combining OCR, GPT-4 integration, and complex CRM API operations.
• Developers needing reliable, structured data extraction using an n8n template.
Manually translating PDF invoices into actionable sales data is slow and error-prone. This robust n8n workflow solves that challenge by providing an end-to-end automation solution. It utilizes an n8n trigger to monitor file uploads, employs OCR technology, and leverages GPT-4 via the 'Message a model' n8n node to perform meticulous data extraction based on a strict schema. The subsequent steps integrate deeply with Salesforce, ensuring that extracted Buyer information leads to an Account Upsert, followed by the creation of a detailed Sales Opportunity and associated Opportunity Line Items (OLIs) derived from your Pricebook Entries. This complete n8n node sequence ensures accurate, fast, and scalable financial data integration.
This automation starts with a file creation event and performs complex data manipulation and CRM synchronization.
folderToWatch ID to your desired incoming folder.pricebook2Id variable to your active Salesforce Pricebook ID (01sxxxxxxxxxxxxxxx).folderidonedrive with your target OneDrive folder ID.https://mydomain.salesforce.com).This n8n template relies on several key n8n node configurations:
Google Drive Trigger (n8n trigger):
Function: Starts the n8n workflow when a new file is created in a specific monitored folder.
Key Configuration: event: fileCreated, triggerOn: specificFolder, using a specific folder ID.
Extract from File (n8n node):
Function: Processes the downloaded PDF binary data, yielding text output. Essential for OCR on scanned invoices.
Key Configuration: operation: pdf (Assumes internal OCR is enabled or available).
Message a model (OpenAI n8n node):
Function: Uses GPT-4 for complex structured data extraction from the raw invoice text into a predictable JSON format.
Key Configuration: modelId: gpt-4.1, jsonOutput: true, utilizes a highly detailed system prompt for schema enforcement and normalization.
Create or update an account (Salesforce n8n node):
Function: Manages Account records in Salesforce. It performs an upsert based on the buyer's Tax ID (mapped to a custom external ID field taxidc).
Create an opportunity (Salesforce n8n node):
Function: Creates the Opportunity record, linking it to the Account ID from the previous step and mapping key extracted fields like grandtotal and issue_date.
Build SOQL (Code n8n node):
Function: A crucial n8n node that dynamically constructs a SOQL query to fetch the necessary PricebookEntry IDs required for creating line items.
Key Configuration: Hardcoded pricebook2Id and dynamic generation of an IN clause using product names from the LLM output.
Code in JavaScript (Code n8n node):
Function: Maps the LLM product lines to the corresponding PricebookEntry IDs retrieved from Salesforce, preparing the final payload structure for the Salesforce Composite API.
Create Opportunity Line Items (HTTP Request n8n node):
Function: Uses the Salesforce Composite API for efficient bulk creation of the Opportunity Line Items.
* Key Configuration: method: POST, utilizes the predefined Salesforce credential for authentication, sends the mapped JSON payload.
Streamline Accounts Payable using this robust n8n workflow template. Automatically extract data from emailed invoices (PDF/image), validate parameters, gain required approvals via Slack, and seamlessly sync finalized data to Google Sheets and Xero. Implement this advanced n8n workflow today.

Leverage this n8n workflow to fully automate invoice processing. Monitor Google Drive for new PDFs, use AI to extract data, file documents by year/month, and log financials in Google Sheets.

Automate invoice processing with this n8n workflow. Uses Gmail as the n8n trigger, analyzes PDF attachments with Azure GPT-4.1, and includes human verification steps before saving files locally.

Use this comprehensive n8n workflow to automate invoice processing. Leverage OCR.Space and GPT-4 to extract company details from Google Drive files, cross-reference data in Google Sheets, and automatically send invoices via Gmail. Perfect n8n templates for finance automation.

Automate AR cash reconciliation by pairing bank statements (via OCR) and ERP invoices using an n8n workflow powered by Mistral AI and GPT-4 matching logic. Use this n8n template today.

Salesforce Architect with 10+ years of experience in CRM, integrations, and automation. Skilled in Apex, LWC, REST APIs, and full-stack dev (JavaScript, .NET). I build secure, scalable workflows in n8n—connecting Salesforce, Stripe, and more. Passionate about lead scoring, data sync, and secure field masking. Certified Application Architect with deep expertise in platform, integration, and data architecture.







































