← Back to all articles

Three n8n nodes, one compliance-ready archive

SealDoc Team · · 5 min read

The hardest part of compliance automation is rarely the rules. It is the plumbing that connects the rules to the systems that already run your business. The rules say every B2B invoice must be in a structured electronic format, archived for ten years, and linkable back to a tamper-evident chain of custody. Your accounting software says “you have a new attachment in shared mailbox.” Bridging those two worlds is where most teams stall.

This post walks through the smallest workflow that actually closes that gap, built with n8n and the n8n-nodes-sealdoc community node. Three connected nodes. Roughly 200 lines of JSON when you export the workflow. Zero custom code.

What we are building

A workflow that does the following on every incoming PDF:

  1. Picks up the file from a trigger of your choice (mailbox, watch folder, Slack upload, an external webhook, anything n8n can listen to).
  2. Hands it to SealDoc, which converts it to PDF/A-3, embeds the Factur-X XML alongside the rendered invoice, attaches an RFC 3161 timestamp, and bundles the lot into a downloadable archive.
  3. Stores the result wherever your retention policy says it belongs.

What you do not have to build yourself: the PDF/A-3 conversion, the Factur-X XML extraction, the timestamping, the audit trail, the evidence-pack manifest hash, the retry logic for the timestamp authority. SealDoc’s API does that work behind one HTTP endpoint.

Prerequisites

  • An n8n instance, either self-hosted or n8n Cloud. The community node works on both.
  • A SealDoc account with at least the Starter plan (the moat features that this workflow depends on, custody and timestamps and evidence packs, ship from Starter onward).
  • A SealDoc API key. Generate one in the dashboard under API keys, copy the secret once (we never show it again).

Install the community node:

npm i n8n-nodes-sealdoc

Restart n8n. The SealDoc node now appears under Nodes with three resources: Job, Validator, and Peppol.

Node 1, the trigger

Pick whichever trigger matches where your invoices land today. We will use Gmail Trigger for this walkthrough because it is the most common shape we see, but the pattern is identical for IMAP, OneDrive, SharePoint, an n8n Webhook URL, or a watched folder.

Configure the Gmail Trigger to fire on new messages with a PDF attachment in a specific label, e.g. incoming-invoices. The output of this node is the binary PDF in attachments[0].data.

Node 2, SealDoc Job · Create

Drop a SealDoc node onto the canvas, set Resource to Job and Operation to Create. Configure:

  • File: bind to {{ $binary.attachments_0 }} (the PDF from Node 1).
  • Embed Factur-X: ON. SealDoc auto-detects the invoice fields and generates the structured XML; if the source PDF already contains an XML attachment, SealDoc respects it and validates rather than overwriting.
  • Timestamp: ON. The output PDF/A-3 will carry an RFC 3161 timestamp from a TSA we operate, queryable later for proof of when the document existed.
  • Retention category: pick the one your tax law mandates (the Dutch Archiefwet category is in the dropdown).

The node returns immediately with a jobId and a status of pending. Do not wait synchronously here. A Factur-X conversion plus timestamp typically completes in under five seconds for a normal invoice, but PDF processing is not deterministic and you do not want a slow tax return PDF to block your whole queue.

Node 3, SealDoc Job · Get

Add another SealDoc node. Set Resource to Job and Operation to Get. Bind Job ID to {{ $node["SealDoc Create"].json.jobId }}. Wrap the node in n8n’s Wait primitive with a 2-second delay and a max of 10 iterations, polling until status is completed or failed.

When completed, the response carries a downloadUrl valid for five minutes. The URL points at the converted PDF/A-3, which is now Factur-X-compliant, timestamped, and registered in our chain of custody.

You also get an evidencePackUrl if your plan includes evidence packs. That ZIP contains the original PDF, the converted PDF/A-3, the Factur-X XML, the RFC 3161 token, the manifest hash file, and a JSON receipt enumerating every step. Auditors love it because it is self-contained and verifiable offline; you can hand a copy to a tax inspector and they can verify integrity without calling our servers.

What about errors

SealDoc returns structured failure reasons in the failureReason field. The four you will see in practice:

  • validation_failed, the source PDF is malformed or password-protected. Surface to the team that uploaded it.
  • unsupported_source, e.g. an actually-encrypted PDF that we cannot open. Bounce back to sender.
  • timestamp_unavailable, our TSA had an outage. We retry automatically; if the retry budget exhausts, the job ends failed and you can re-run it.
  • quota_exceeded, your plan’s monthly job count has hit the ceiling. Either upgrade or wait for the reset.

In n8n, route the failed branch of the Get node into a Slack or email notification so a human knows when something is genuinely stuck.

Why three nodes is enough

You will notice this workflow does no validation, signing, or archival logic itself. That is the point. SealDoc’s API is the boundary; your n8n workflow is the connective tissue between that boundary and your business systems. When the Belgian B2B mandate goes live you do not have to rebuild this workflow. When France’s September 2026 obligation kicks in you do not have to rebuild it. When the regulator updates the Factur-X profile in 2027, you upgrade the SealDoc node version.

That is the value of the connector pattern: regulatory churn lives in our codebase, not yours.

Beyond n8n

If you do not use n8n, every operation in this tutorial is also available through SealDoc’s REST API directly, or through Webhooks if you want push notifications instead of polling. The full menu lives on our integrations page, with copy-pasteable examples for each surface. Make, Zapier and Exact Online connectors are in active build; if your stack uses any of those, drop us a line for early access.

The compliance plumbing is solved. What you do with the time you save is up to you.


← Back to all articles