Quick overview
This workflow monitors a Gmail inbox for incoming XML or PDF invoice attachments, validates each file with invoapi against e-invoice rules, saves valid invoices to Google Drive, replies to suppliers with validation errors, and forwards non-e-invoices or failed checks to accounting for manual review.
How it works
- Triggers every minute when a new Gmail email arrives that has an XML or PDF attachment.
- Extracts only XML and PDF attachments and creates one workflow item per attachment while carrying over the email metadata needed for follow-up.
- Sends each attachment to invoapi to validate it as an EN 16931/XRechnung-compatible e-invoice and returns a validation report.
- Uploads invoices marked as valid to the configured Google Drive accounting folder.
- For invoices marked as invalid, composes a readable error list from the invoapi report and replies to the supplier in the original Gmail thread.
- For attachments that are not detected as e-invoices or where validation fails, forwards a review request email to the configured accounting address.
Setup
- Install and configure the invoapi community node (n8n-nodes-invoapi) and add an invoapi API credential.
- Add Gmail credentials for the inbox to monitor and to send replies/forwards.
- Add Google Drive credentials and set the target Drive folder ID in the workflow configuration.
- Update the review/forwarding email address in the workflow configuration and adjust the Gmail search query if you want to limit which emails are processed.