{"product_id":"n8n-workflow-parse-incoming-xrechnung-via-imap-archive-xml","title":"n8n Workflow: Parse Incoming XRechnung via IMAP \u0026 Archive XML","description":"\u003ch3\u003eParse and validate incoming XRechnung invoices automatically (IMAP → archive → reporting)\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow monitors an IMAP mailbox for incoming invoice emails, extracts attached XRechnung (UBL) XML files, validates mandatory EN 16931 fields and totals, archives the XML to the appropriate folder, and logs results to an n8n Data Table—alerting accounting when something goes wrong.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eReads new emails via IMAP\u003c\/b\u003e and downloads attachments from the configured mailbox.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eDetects XRechnung XML attachments\u003c\/b\u003e: searches for a \u003ccode\u003e.xml\u003c\/code\u003e file and ignores emails without an XML attachment.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eParses and normalizes the invoice\u003c\/b\u003e: extracts the XML text, converts it to JSON, and parses UBL Invoice fields into a normalized invoice object.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eReports processing errors\u003c\/b\u003e for non-UBL\/invalid XML so issues are visible and actionable.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eValidates against EN 16931 requirements\u003c\/b\u003e, recalculates totals and tax breakdowns, and checks for inconsistencies.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eArchives XML files\u003c\/b\u003e:\n    \u003cul\u003e\n      \u003cli\u003eValid invoices are saved to a \u003cb\u003e“gueltig”\u003c\/b\u003e folder.\u003c\/li\u003e\n      \u003cli\u003eInvalid invoices are saved to a \u003cb\u003e“fehlerhaft”\u003c\/b\u003e folder.\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eLogs key invoice metadata\u003c\/b\u003e and amounts into an n8n \u003cb\u003eData Table\u003c\/b\u003e named \u003cb\u003e“Rechnungseingang”\u003c\/b\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eSends email notifications\u003c\/b\u003e to accounting when validation fails (including an error list), and—if enabled and the sender is not a no-reply address—sends a follow-up request to the original sender for correction.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eAutomating \u003cb\u003eXRechnung\u003c\/b\u003e intake for accounts payable by validating EN 16931 fields immediately upon receipt.\u003c\/li\u003e\n  \u003cli\u003eReducing manual invoice handling using \u003cb\u003eIMAP-based email attachment processing\u003c\/b\u003e with clear “gueltig\/fehlerhaft” audit trails.\u003c\/li\u003e\n  \u003cli\u003eProviding accounting teams with structured invoice data in an \u003cb\u003en8n Data Table\u003c\/b\u003e for reporting and reconciliation.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eIMAP\u003c\/b\u003e email polling + attachment download\u003c\/li\u003e\n  \u003cli\u003eNodes\/logic: \u003cb\u003eif\u003c\/b\u003e, \u003cb\u003eset\u003c\/b\u003e, \u003cb\u003exml\u003c\/b\u003e, \u003cb\u003ecode\u003c\/b\u003e, \u003cb\u003eno op\u003c\/b\u003e, \u003cb\u003edata table\u003c\/b\u003e\n\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eXML → JSON conversion\u003c\/b\u003e, UBL invoice field parsing, total\/tax recalculation checks\u003c\/li\u003e\n  \u003cli\u003eArchiving to \u003cb\u003e“gueltig”\u003c\/b\u003e and \u003cb\u003e“fehlerhaft”\u003c\/b\u003e folders\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eSMTP email notifications\u003c\/b\u003e for accounting and optional sender follow-ups\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003cp\u003e\u003ci\u003eSetup summary:\u003c\/i\u003e configure IMAP for invoice mail retrieval, configure SMTP for notifications, and create\/select the \u003cb\u003e“Rechnungseingang”\u003c\/b\u003e Data Table with mapped columns.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45764316201139,"sku":"N8N-17864","price":19.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/mZs5bjT1QW3aV5zWOxb2r_TEUqtNdR.png?v=1786007089","url":"https:\/\/buyflowscripts.com\/products\/n8n-workflow-parse-incoming-xrechnung-via-imap-archive-xml","provider":"N8N Commerce","version":"1.0","type":"link"}