๐Ÿงพ Process invoices and send weekly AI reports with OpenAI and Gmail

โšก 69 views ยท ๐Ÿงพ Invoice Processing

Description

Overview

This workflow automates invoice handling from upload to reporting using AI.

Users submit invoices through a simple form. The workflow extracts key details, validates the data, stores valid invoices, and sends email notifications. It also generates a weekly summary report automatically.

This helps reduce manual data entry and ensures consistent invoice processing.


How It Works

  1. Form Submission Users upload an invoice (PDF or image) along with their email.

  2. Initial Storage The raw submission is stored for tracking and reference.

  3. Text Extraction The uploaded file is processed to extract text content.

  4. AI Data Extraction AI converts the raw text into structured invoice data such as invoice number, vendor, date, currency, and totals.

  5. Validation The workflow checks:

    • Date format (YYYY-MM-DD)
    • Allowed currencies
    • Total amount validity
  6. Conditional Flow

    • If valid โ†’ invoice is stored and a success email is sent
    • If invalid โ†’ an error email is sent with details
  7. Weekly Reporting A scheduled trigger runs weekly to:

    • Fetch all validated invoices
    • Generate a summary report using AI
    • Send the report via email

Setup Instructions

  1. Add your OpenAI credentials (used for data extraction and reporting)
  2. Connect Gmail credentials for sending emails
  3. Configure Data Tables:
    • invoice_form_submissions
    • validated_invoices
  4. Update the Workflow Configuration node:
    • Set report recipient email
    • Adjust allowed currencies if needed
  5. Ensure the file field (invoiceFile) is correctly mapped
  6. Test with a sample invoice
  7. Activate the workflow

Use Cases


Requirements


Notes

๐Ÿ”— Nodes Used

Gmail, Schedule Trigger, AI Agent, OpenAI Chat Model, Structured Output Parser, n8n Form Trigger

๐Ÿ“ฅ Import

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

๐Ÿ“– Importing guide ยท ๐Ÿ”‘ Credential setup