Skip to main content
Data Processing & Analysis Triggered

Code Filter Process Triggered

1
14 downloads
15-45 minutes
🔌
4
Integrations
Intermediate
Complexity
🚀
Ready
To Deploy
Tested
& Verified

What's Included

📁 Files & Resources

  • Complete N8N workflow file
  • Setup & configuration guide
  • API credentials template
  • Troubleshooting guide

🎯 Support & Updates

  • 30-day email support
  • Free updates for 1 year
  • Community Discord access
  • Commercial license included

Agent Documentation

Standard

Code Filter Process Triggered – Data Processing & Analysis | Complete n8n Triggered Guide (Intermediate)

This article provides a complete, practical walkthrough of the Code Filter Process Triggered n8n agent. It connects HTTP Request, Webhook across approximately 1 node(s). Expect a Intermediate setup in 15-45 minutes. One‑time purchase: €29.

What This Agent Does

This agent orchestrates a reliable automation between HTTP Request, Webhook, handling triggers, data enrichment, and delivery with guardrails for errors and rate limits.

It streamlines multi‑step processes that would otherwise require manual exports, spreadsheet cleanup, and repeated API requests. By centralizing logic in n8n, it reduces context switching, lowers error rates, and ensures consistent results across teams.

Typical outcomes include faster lead handoffs, automated notifications, accurate data synchronization, and better visibility via execution logs and optional Slack/Email alerts.

How It Works

The workflow uses standard n8n building blocks like Webhook or Schedule triggers, HTTP Request for API calls, and control nodes (IF, Merge, Set) to validate inputs, branch on conditions, and format outputs. Retries and timeouts improve resilience, while credentials keep secrets safe.

Third‑Party Integrations

  • HTTP Request
  • Webhook

Import and Use in n8n

  1. Open n8n and create a new workflow or collection.
  2. Choose Import from File or Paste JSON.
  3. Paste the JSON below, then click Import.
  4. Show n8n JSON
    Title:
    Automating Colombian Electronic Invoice Processing with n8n, OpenAI, and Google Workspace
    
    Meta Description:
    Discover how an n8n workflow automates the extraction, validation, storage, and reporting of Colombian electronic invoices from Gmail using OpenAI's GPT-4o, Google Drive, and Google Sheets.
    
    Keywords:
    n8n Colombia, electronic invoice automation, DIAN invoice processing, Colombian facturas electrónicas, Gmail invoice filter, OpenAI GPT-4o invoices, Google Drive workflow, Google Sheets invoice tracker, XML PDF invoice extractor, AI invoice parser, LangChain n8n integration, automation Colombian tax compliance
    
    Article:
    
    Automating the Processing of Colombian Electronic Invoices with n8n and OpenAI
    
    In Colombia, businesses and individuals receive electronic invoices (facturas electrónicas) in formats defined by DIAN (Dirección de Impuestos y Aduanas Nacionales). These invoices often come as ZIP attachments containing both XML and PDF files. For individuals managing their personal or small-scale accounting, organizing these documents can become tedious. Enter n8n — a powerful, open-source workflow automation platform — paired with OpenAI and Google Workspace to create a seamless, intelligent system for extracting, validating, and archiving invoice data.
    
    This article explores a custom-built n8n workflow that automates the entire invoice handling pipeline with minimal user input and maximum reliability.
    
    The Purpose: From Inbox to Insights
    
    This n8n workflow is designed to automate the parsing and recording of invoice data as defined by DIAN specifications. Every 30 minutes, it scans a Gmail inbox for ZIP files likely containing invoices, extracts and analyzes essential data from the enclosed PDF and XML files, checks the financial correctness of the totals, uploads the invoice to Google Drive under a structured name format, and updates a Google Sheets document used for tracking — all without human intervention.
    
    Breakdown of Key Features
    
    1. Email Monitoring & Attachment Filtering
    The workflow begins with a Gmail Trigger node. It scans for every new email that:
    - Contains a ZIP attachment
    - Has the filename ending in ".zip"
    
    This ensures practical compatibility with DIAN's standard for electronic invoice delivery.
    
    2. Extracting Files from ZIP Attachments
    After identifying relevant emails, the ZIP file is uncompressed. The system then filters to focus exclusively on XML and PDF files—the two formats containing structured invoice data and visual confirmation.
    
    3. Smart Data Extraction with AI
    Post extraction, the magic happens via the integration of LangChain’s agent node and OpenAI’s GPT-4o-mini language model. This AI combo is tasked to:
    - Parse content from both PDF and XML documents.
    - Extract standard invoice fields mandated by Colombian tax laws, including:
      - Tipo (Factura or Nota Crédito)
      - Número de Factura
      - Fecha de Emisión (Formatted YYYY-MM-DD)
      - NIT (Tax ID) of Issuer and Receiver (without verification digits)
      - Razón Social of the Issuer (Business Name)
      - Subtotal, IVA (Value-Added Tax), and Total
      - CUFE (Unique Electronic Invoicing Code)
      - A natural-language purchase summary in ≤20 words
    
    4. Data Integrity Check
    An essential part of the flow includes a validation step. A Calculator node ensures the Total is mathematically accurate (Subtotal + IVA = Total). If the math doesn’t check out, the process can be adapted to flag or stop the record.
    
    5. Organized Cloud Storage
    The extracted PDF file is uploaded to Google Drive under a “Facturas” folder (or any designated directory). Initially placed with a generic name, it's renamed post-analysis to:
    YYYY-MM-DD-NUMERO_FACTURA.pdf
    This naming convention ensures clarity and searchability for future reference.
    
    6. Centralized Recordkeeping with Google Sheets
    To maintain a structured ledger, the workflow updates (or appends) each correctly parsed invoice to a Google Sheets spreadsheet. Each row includes all extracted values and is indexed uniquely using the combination of issuer NIT and invoice number, ensuring no duplicates.
    
    Technologies and APIs Used
    
    This intelligent automation heavily depends on seamless integration with robust third-party services:
    
    Third-Party APIs Used:
    
    1. Gmail API  
       - Used via n8n’s Gmail Trigger node to read incoming emails and download attachments.
    
    2. Google Drive API  
       - Handles upload and file renaming operations in a cloud folder for safekeeping of original invoice files.
    
    3. Google Sheets API  
       - Appends or updates structured invoice data into a centralized sheet, powering analytics or tax preparation.
    
    4. OpenAI API (GPT-4o-mini model)
       - Executes natural language understanding and field extraction from unstructured XML and PDF content.
    
    5. LangChain (n8n Langchain Nodes)
       - Provides AI agents and utilities (like tools and parsers) that turn OpenAI into a context-aware data processor.
    
    Why This Workflow Matters
    
    In a regulatory environment like Colombia’s, individuals and businesses must adhere to strict e-invoicing rules set by DIAN. This workflow ensures compliance while eliminating hours of manual labor spent opening emails, extracting files, interpreting data, and filling out logs.
    
    Designed with personal use in mind, it balances high reliability with a low-frequency polling rate (every 30 minutes), a perfect interval for non-enterprise tracking.
    
    Final Thoughts
    
    This n8n workflow provides an excellent example of how no-code/low-code automation platforms, when integrated with powerful AI services like OpenAI and productivity tools like Google Workspace, can offer intelligent solutions even for country-specific compliance tasks.
    
    Whether you're a tech-savvy individual managing your invoices or a small business optimizing internal workflows, this setup can serve as a template for automating complex, repetitive documentation processes — one invoice at a time.
    
    — End —
    
    Let me know if you'd like me to convert this into a PDF or generate accompanying workflow diagrams!
  5. Set credentials for each API node (keys, OAuth) in Credentials.
  6. Run a test via Execute Workflow. Inspect Run Data, then adjust parameters.
  7. Enable the workflow to run on schedule, webhook, or triggers as configured.

Tips: keep secrets in credentials, add retries and timeouts on HTTP nodes, implement error notifications, and paginate large API fetches.

Validation: use IF/Code nodes to sanitize inputs and guard against empty payloads.

Why Automate This with AI Agents

AI‑assisted automations offload repetitive, error‑prone tasks to a predictable workflow. Instead of manual copy‑paste and ad‑hoc scripts, your team gets a governed pipeline with versioned state, auditability, and observable runs.

n8n’s node graph makes data flow transparent while AI‑powered enrichment (classification, extraction, summarization) boosts throughput and consistency. Teams reclaim time, reduce operational costs, and standardize best practices without sacrificing flexibility.

Compared to one‑off integrations, an AI agent is easier to extend: swap APIs, add filters, or bolt on notifications without rewriting everything. You get reliability, control, and a faster path from idea to production.

Best Practices

  • Credentials: restrict scopes and rotate tokens regularly.
  • Resilience: configure retries, timeouts, and backoff for API nodes.
  • Data Quality: validate inputs; normalize fields early to reduce downstream branching.
  • Performance: batch records and paginate for large datasets.
  • Observability: add failure alerts (Email/Slack) and persistent logs for auditing.
  • Security: avoid sensitive data in logs; use environment variables and n8n credentials.

FAQs

Can I swap integrations later? Yes. Replace or add nodes and re‑map fields without rebuilding the whole flow.

How do I monitor failures? Use Execution logs and add notifications on the Error Trigger path.

Does it scale? Use queues, batching, and sub‑workflows to split responsibilities and control load.

Is my data safe? Keep secrets in Credentials, restrict token scopes, and review access logs.

Keywords: n8n colombia, electronic invoice automation, dian invoice processing, colombian facturas electrónicas, gmail invoice filter, openai gpt-4o invoices, google drive workflow, google sheets invoice tracker, xml pdf invoice extractor, ai invoice parser, langchain n8n integration, automation colombian tax compliance, gmail api, google drive api, google sheets api, openai api

Integrations referenced: HTTP Request, Webhook

Complexity: Intermediate • Setup: 15-45 minutes • Price: €29

Requirements

N8N Version
v0.200.0 or higher required
API Access
Valid API keys for integrated services
Technical Skills
Basic understanding of automation workflows
One-time purchase
€29
Lifetime access • No subscription

Included in purchase:

  • Complete N8N workflow file
  • Setup & configuration guide
  • 30 days email support
  • Free updates for 1 year
  • Commercial license
Secure Payment
Instant Access
14
Downloads
1★
Rating
Intermediate
Level