Validate EN 16931 e-invoices from Gmail and create draft bills in Xero
Ready for 3.0What this workflow does
This workflow has 46 nodes and runs on Gmail events. Along the way it connects Gmail and Xero. It also calls api.xero.com over HTTP.
How it runs
Trigger: On Gmail events.
- E-Invoice Policy (Edit Fields (Set)): sets 8 fields: bookkeeper_email, xero_organisation, xero_account_code…
- Mark The Email As Read (Gmail): mark as read (message)
- Read The E-Invoice (Code): runs custom JavaScript code
- Label The Invoice (Edit Fields (Set)): sets 7 fields: label, checked_on, outcome…
- What Was Attached? (Switch): routes items into 3 branches
- Plain PDFs Still Accepted? (If): checks a condition and branches into true / false
- Reason: File Could Not Be Read (Edit Fields (Set)): sets 1 field: problems
- Add Up The Invoice (Edit Fields (Set)): sets 5 fields: tolerance_used, sum_lines, expected_net…
- Reason: Plain PDF, Still Accepted (Edit Fields (Set)): sets 1 field: reason
- Reason: Plain PDF, Too Late (Edit Fields (Set)): sets 1 field: problems
…plus 35 more steps. See the full node list below.
Services it uses
Other Gmail + Xero templates (7)
HTTP calls to: api.xero.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Invoice Email Arrives).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (11)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Gmail
n8n-nodes-base.gmail - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - If
n8n-nodes-base.if - HTTP Request
n8n-nodes-base.httpRequest - Stop and Error
n8n-nodes-base.stopAndError - Merge
n8n-nodes-base.merge - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Xero
n8n-nodes-base.xero
From the author
Quick overview German businesses must accept e-invoices (XRechnung or ZUGFeRD), but Xero cannot read them. This reads them straight from your Gmail, checks they are correct, and turns the good ones into Xero draft bills for you to approve. How it works 1. It…