<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SolutionsCraft</title>
    <description>The latest articles on DEV Community by SolutionsCraft (@thesolutionscraft).</description>
    <link>https://dev.to/thesolutionscraft</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4118342%2F16022825-d93b-4bdd-b703-994a94a1e871.png</url>
      <title>DEV Community: SolutionsCraft</title>
      <link>https://dev.to/thesolutionscraft</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thesolutionscraft"/>
    <language>en</language>
    <item>
      <title>Silent Failure Watch Review: Catch Quiet n8n Failures</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Tue, 10 Nov 2026 05:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/silent-failure-watch-review-catch-quiet-n8n-failures-1357</link>
      <guid>https://dev.to/thesolutionscraft/silent-failure-watch-review-catch-quiet-n8n-failures-1357</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; We're affiliates of Krafera, the maker of Silent Failure Watch, so we earn a commission if you buy through our links, at no extra cost to you. Krafera also gave us a free copy to review. The opinions are ours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reader offer:&lt;/strong&gt; use code SOLUTIONSCRAFT20 for 20 percent off. &lt;a href="https://gumroad.com/a/1005228387/lltue?offer_code=SOLUTIONSCRAFT20" rel="noopener noreferrer"&gt;Get Silent Failure Watch with 20 percent off&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This Silent Failure Watch review looks at Krafera's creative answer to a quiet n8n problem. A workflow that fails loudly is easy to spot. One that stops running without a word is not: a schedule that never fires raises no error in n8n, so nobody is told. Silent Failure Watch is a pack of nine n8n workflows built to notice exactly that, and this review covers what is in the pack, how it did in our local test lab, what it costs and who it suits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The short answer:&lt;/strong&gt; if you run self-hosted n8n 2.x, for yourself or for clients, Silent Failure Watch is a practical, thoughtful way to find out when a workflow quietly stops. It &lt;strong&gt;catches workflows that go quiet&lt;/strong&gt; , &lt;strong&gt;emails you once when something goes wrong and once when it recovers&lt;/strong&gt; , and &lt;strong&gt;stays silent when all is well&lt;/strong&gt; (apart from the Monday report in the Full pack). The Full pack also adds &lt;strong&gt;ready-made client handover documents&lt;/strong&gt;. The entry pack is $12, or about $9.60 with our reader code, so &lt;a href="https://gumroad.com/a/1005228387/lltue?offer_code=SOLUTIONSCRAFT20" rel="noopener noreferrer"&gt;getting Silent Failure Watch with 20 percent off&lt;/a&gt; is an easy first step.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; Nothing failed. Nothing ran either. On paper, that is a perfect error record.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What you get in the pack
&lt;/h2&gt;

&lt;p&gt;Nine workflows for your own self-hosted n8n, plus handover documents for client work. Here is what each one does for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Did it run&lt;/strong&gt; is the heart of the pack, and its name is the question it answers. Every 15 minutes it goes through the workflows on your watch list and checks that each one still exists, is switched on, did not fail last time and, if you set a time limit, has run successfully within it. You get &lt;strong&gt;one email when something goes wrong and one when it is back to normal&lt;/strong&gt; , and nothing while nothing changes. It also points out active workflows that have no error workflow set, and it can ping an outside uptime service after every check, so you hear about it even if the watcher itself or your whole server stops.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Error alert&lt;/strong&gt; emails you when a workflow fails, with &lt;strong&gt;the workflow, the step, the error, the record involved and a link to the run&lt;/strong&gt;. Repeats are counted instead of flooding your inbox, and you can &lt;strong&gt;send each workflow's alerts to its own owner&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Count check&lt;/strong&gt; compares yesterday's rows in two places, so &lt;strong&gt;a sync that finished without an error but skipped a few orders shows up&lt;/strong&gt; , along with extras and mismatched values. It ships set up for example tables, so you point it at your own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhook intake&lt;/strong&gt; and &lt;strong&gt;Webhook reconciliation&lt;/strong&gt; log each incoming event once, so &lt;strong&gt;repeat deliveries are ignored&lt;/strong&gt; , and each morning it compares your sender's own list with the log and emails you only if events never arrived or were processed twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Process with retry&lt;/strong&gt; and &lt;strong&gt;Retry failed items&lt;/strong&gt; send items to an API one at a time, so &lt;strong&gt;one failing item does not stop the rest&lt;/strong&gt;. Failed items are tried again, and after five attempts in all you get one email listing what was given up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nightly backup&lt;/strong&gt; writes &lt;strong&gt;a dated backup of all your workflows every night&lt;/strong&gt; and reads the file back and counts the workflows against n8n, emailing you only if the file cannot be written or the copy does not match. Our post on &lt;a href="https://solutionscraft.com/automation/n8n-backup-workflows-credentials-restore-test" rel="noopener noreferrer"&gt;backing up n8n and testing the restore&lt;/a&gt; shows how to check a restore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weekly health email&lt;/strong&gt; is &lt;strong&gt;a Monday report&lt;/strong&gt; : for each watched workflow, the runs and failures of the last seven days (from each workflow's 250 newest runs), the last success, and any items waiting for a retry or given up. Send it to your client and keep the alerts with you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Full pack also includes &lt;strong&gt;a one-page monitoring handover for client work&lt;/strong&gt; , as a blank template and as a filled example, so you can show a client exactly what is watched, who gets which message and who fixes what.&lt;/p&gt;

&lt;p&gt;It suits freelancers and agencies running client automations on their own server, and the license covers your own clients. You need self-hosted n8n 2.x with Data tables, an n8n API key that lets the workflows read your workflows and runs, a mail account for the alerts, and n8n set to keep successful runs for longer than your longest time limit. It isn't written for n8n Cloud. We looked at it on its own rather than against other options, so for n8n silent failure monitoring, read this as one detailed look rather than a comparison.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it did in our Silent Failure Watch review
&lt;/h2&gt;

&lt;p&gt;We tried the Full pack in our own local test lab, with test data only, and looked at four things.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nothing hidden inside.&lt;/strong&gt; We read through all nine workflows and found no hidden addresses, hidden code or stored secrets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It keeps to itself.&lt;/strong&gt; While it ran we watched the network traffic, and the pack contacted nothing beyond the addresses we had set up for it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It sets up cleanly.&lt;/strong&gt; All nine files imported without errors, and the workflows created the data tables they use on the first run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Did it run catches quiet failures.&lt;/strong&gt; This is the check-up workflow described above, so it was the test that mattered most. We ran 26 checks of its alerts (a workflow switched off, failing, deleted or quiet past its time limit, and the email when it recovers), and it passed all 26.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; A monitoring pack that does not phone home. I would shake its hand, if I had one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Setting it up
&lt;/h2&gt;

&lt;p&gt;The README walks you through setup step by step, including a "try a bad day" drill: switch off one watched workflow, and within 15 minutes an email names it. Switch it back on, and the next email says it is back to normal. It is a satisfying way to see the pack earn its place. Two choices are worth making on day one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Give the pack its own narrow API key.&lt;/strong&gt; The README names the three read permissions it needs: list workflows, list executions and read executions. A key with just those was enough for the workflows that use it, and it was refused when we tried to create a workflow with it, which is the careful kind of advice you want from a monitoring pack. If a key ever lands somewhere public, our post on &lt;a href="https://solutionscraft.com/automation/audit-n8n-leaked-api-tokens" rel="noopener noreferrer"&gt;leaked n8n API keys&lt;/a&gt; covers rotating it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Limit that key to your own n8n address.&lt;/strong&gt; The README shows how to restrict the API credential to your n8n host, so the pack's web requests cannot send the key anywhere else, and reminds you to check the base URL on the credential itself, because the three workflow-list steps use it as written. With the restriction on and a mistyped address, one of those web requests stopped with "Domain not allowed" instead of sending the key off.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs, and how to save 20 percent
&lt;/h2&gt;

&lt;p&gt;There are three packs, and the reader code covers all of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single, $12 (about $9.60 with the code):&lt;/strong&gt; Did it run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core, $39 (about $31.20):&lt;/strong&gt; Did it run, Count check and Error alert.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full, $79 (about $63.20):&lt;/strong&gt; all nine workflows and the handover folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Krafera backs the pack with a &lt;strong&gt;14-day money-back guarantee&lt;/strong&gt; : if the product does not install or does not work as described, you message Krafera through Gumroad within 14 days of purchase and get a full refund.&lt;/p&gt;

&lt;p&gt;Krafera gives our readers the code SOLUTIONSCRAFT20 for 20 percent off every pack, and our link already includes it. If you are weighing Single, Core and Full, &lt;a href="https://gumroad.com/a/1005228387/lltue?offer_code=SOLUTIONSCRAFT20" rel="noopener noreferrer"&gt;get Silent Failure Watch with 20 percent off&lt;/a&gt; and compare all three on the product page before you choose.&lt;/p&gt;

&lt;h2&gt;
  
  
  A few heads-ups for a smooth setup
&lt;/h2&gt;

&lt;p&gt;To keep things smooth:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On a newer n8n, try it on a copy first.&lt;/strong&gt; We checked Silent Failure Watch on n8n 2.x. On a newer major version, test it on a copy first. If you run n8n from npm, our guide on &lt;a href="https://solutionscraft.com/automation/move-n8n-npm-to-docker-before-v3" rel="noopener noreferrer"&gt;moving to Docker before n8n 3.0&lt;/a&gt; helps with that prep.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify-style sender? Three quick settings.&lt;/strong&gt; Set the intake's id field as the README table says. Left on the default, a second event about the same order can be skipped as a duplicate without any error message. Signed senders such as Shopify also cannot send Krafera's key header, so add your own signature check in your processing step, as the README describes. For the morning reconciliation, your sender's own list of events must hold the same webhook ids as the Shopify header ids, otherwise it reports false alarms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep alerts, backups and saved runs private.&lt;/strong&gt; Error alert hides the secrets it recognizes, but not every format, so keep secrets out of free-text fields and send alerts only to people who may see that data. The backup folder and n8n's saved runs can hold the intake key and any key you pasted straight into a node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A few more edge cases.&lt;/strong&gt; Very large numeric ids are refused, so use a header id or send the id as text. Two copies of an event arriving at the very same instant, or a replay under a new id, can both be processed, so make your processing step safe to repeat. The weekly report reads each workflow's 250 newest runs, so on a very busy workflow older failures are not counted. Krafera's LIMITS file covers the large ids and the same-instant copies; the replay point comes from our own testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Our verdict, and where to start
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Our verdict.&lt;/strong&gt; Silent Failure Watch is a creative, thoughtful and practical pack. It tackles a real problem, workflows that stop without any error, it is easy to try at $12, or about $9.60 with our code, and the client handover documents are a lovely touch for anyone who looks after other people's automations. We recommend it to anyone running self-hosted n8n 2.x, especially anyone who skims the heads-ups above and the LIMITS file first.&lt;/p&gt;

&lt;p&gt;If you want the simplest win, start with Single: Did it run alone tells you when a workflow quietly stops. Core adds Count check and Error alert. Full adds the webhook, retry, backup and weekly report workflows and the handover documents, which makes it the one for client work. With the 14-day money-back guarantee behind it, &lt;a href="https://gumroad.com/a/1005228387/lltue?offer_code=SOLUTIONSCRAFT20" rel="noopener noreferrer"&gt;get Silent Failure Watch with 20 percent off&lt;/a&gt; and pick the pack that fits you. The code SOLUTIONSCRAFT20 is already built into that link.&lt;/p&gt;

&lt;p&gt;If you would like more reviews like this one, you will find them alongside our other n8n guides in &lt;a href="https://solutionscraft.com/automation" rel="noopener noreferrer"&gt;the automation section&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; The product links in this article are affiliate links: if you buy through them, we may earn a commission at no extra cost to you. We agreed to the affiliate arrangement with Krafera before publishing this article, and Krafera gave us a free copy of the Full pack, through a one-use code, to review. Krafera provides the reader code SOLUTIONSCRAFT20, and it does not change what we found. Krafera's README links to three of our guides (the same three we link in this article), because we offered them. That link is in our favour, so we say so. We wrote every word of this article ourselves. Before publishing, we sent Krafera a longer write-up of the limits we found, and Krafera checked it against its current README and limits file and found no factual errors. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for how we handle affiliate links in general.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;The SolutionsCraft team&lt;/em&gt;&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Test Your n8n Workflow Before Handoff</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 30 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/test-your-n8n-workflow-before-handoff-2k6a</link>
      <guid>https://dev.to/thesolutionscraft/test-your-n8n-workflow-before-handoff-2k6a</guid>
      <description>&lt;p&gt;You build the workflow, run it once in the editor with a tidy example row, watch every node light up green, and send the client a screen recording. Then it goes live, meets a real customer's real data on a Tuesday afternoon, and falls over on the one field that was empty this time. A workflow that ran clean once has been demoed, not tested, and the gap between those two words is exactly where handoffs go wrong. If you want to actually test an n8n workflow before handoff rather than just show it working, that means deliberately feeding it the inputs you're pretty sure it'll never see, and watching what happens when it doesn't like one.&lt;/p&gt;

&lt;p&gt;None of this is exotic. It's five things n8n already gives you a way to do, used on purpose instead of by accident.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need edit access to the workflow you're about to hand off, and a workflow that's actually built, not a work in progress, since the point here is testing something close to final. Nothing below needs a paid plan or anything outside n8n itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Pin real-looking data to every branch, not just the main path
&lt;/h2&gt;

&lt;p&gt;Open the workflow and, for each node that branches on data (an IF, a Switch, anything downstream of one), run it once with input that actually takes each branch, then pin that output. Per n8n's own &lt;a href="https://docs.n8n.io/build/work-with-data/pin-and-mock-data" rel="noopener noreferrer"&gt;data pinning docs&lt;/a&gt;, pinning saves a node's output and reuses it on later test runs instead of hitting the real service again, which is exactly what you want here: you can re-run the workflow against the same awkward case as many times as it takes to fix, without spending another API call or waiting on another webhook to arrive. It's deliberately a development-only mechanic too, the docs are explicit that pinned data gets ignored the moment the workflow is active and running for real, so there's no risk of a test fixture quietly leaking into production.&lt;/p&gt;

&lt;p&gt;One thing worth knowing going in: pinning a node's output doesn't skip the nodes upstream of it. A community answer from n8n's own team notes that the workflow still runs in full, pinning just swaps in saved data at that one spot rather than skipping ahead. Useful to know before you assume a pinned branch means a faster execution, it doesn't, it just means a stable one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Test the workflow with inputs it's never seen
&lt;/h2&gt;

&lt;p&gt;This is the step a demo always skips, because a demo is built around data that makes the workflow look good. Testing is built around data that might make it look bad: an empty list where you expected at least one row, a record missing a field you assumed would always be there.&lt;/p&gt;

&lt;p&gt;To show what "untested" actually costs, not just assert it, I wrote two versions of the kind of totals calculation a Code node in an order-processing workflow might do, and ran both against three inputs: a normal case, an empty list, and one line item missing its &lt;code&gt;price&lt;/code&gt; field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;naive_total&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"qty"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hardened_total&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;qty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"qty"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"line item missing 'price': {item}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running both against all three cases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--- happy path (2 normal line items) ---
naive_total: 29.0
hardened_total: 29.0

--- empty input (no line items at all) ---
naive_total: 0
hardened_total: 0

--- malformed input (one item missing 'price') ---
naive_total: CRASHED -&amp;gt; KeyError: 'price'
hardened_total: CRASHED -&amp;gt; ValueError: line item missing 'price': {'qty': 1}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The empty-input case is the trap: both versions handle it fine, which means if that's the only edge case you tried, you'd walk away thinking the workflow was solid. The malformed case is where they actually diverge, and notice that &lt;em&gt;both&lt;/em&gt; versions fail. That's not the point. The point is what the failure looks like: a bare &lt;code&gt;KeyError: 'price'&lt;/code&gt; tells whoever's debugging it at 2am nothing about which record or which field; the &lt;code&gt;ValueError&lt;/code&gt; with the item attached tells them exactly where to look. A test pass isn't about making failure impossible, it's about making sure that when it happens, it happens loudly and specifically instead of as a cryptic stack trace three nodes downstream.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt;"It worked when I tried it" is true of almost every bug that ever shipped. That's not a defense, it's the whole problem.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Translate this into your actual workflow by editing a pinned dataset from Step 1 to be missing a field, empty, or the wrong type, and re-running. If a Code node or an expression throws something as unhelpful as that first &lt;code&gt;KeyError&lt;/code&gt;, that's your fix list before handoff, not after.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Make a node fail on purpose and watch where the failure goes
&lt;/h2&gt;

&lt;p&gt;Pinning bad data gets you most of the way, but some failures you want to trigger directly rather than construct an input for, a timeout, a downstream service being down, a credential that's been revoked. n8n's &lt;a href="https://docs.n8n.io/nodes/n8n-nodes-base.errorTrigger" rel="noopener noreferrer"&gt;Stop And Error node&lt;/a&gt; exists partly for this: it's built to simulate a node failure deliberately, including a custom error message, so you can test the rest of your error handling without needing the real failure condition to occur. Drop one in place of a node you can't easily break safely (a live webhook call to a client's CRM, say) and confirm the workflow actually reacts the way you expect, rather than assuming it will because the happy path reacted fine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Wire up an error workflow so a failure doesn't just disappear
&lt;/h2&gt;

&lt;p&gt;A workflow that fails loudly in the editor but silently in production hasn't been tested for the thing that actually matters: whether &lt;em&gt;anyone finds out&lt;/em&gt;. Per n8n's &lt;a href="https://docs.n8n.io/flow-logic/error-handling/" rel="noopener noreferrer"&gt;error handling docs&lt;/a&gt;, an error workflow starts with the dedicated Error Trigger node, and you assign it to another workflow from that workflow's own Settings panel, under Error Workflow. Once it's wired up, a failure in the monitored workflow fires the Error Trigger in the other one, handing it details about what broke, instead of just logging a red X nobody's watching for.&lt;/p&gt;

&lt;p&gt;Keep the error workflow itself simple: a Slack message, an email, whatever actually reaches you, with the failing workflow's name and the error message in it. Then confirm it actually fires, using the Stop And Error node from Step 3. One real caveat worth knowing before you rely on this: per the docs, an Error Trigger doesn't fire for a manual execution in the editor, only for a failure in a running (activated) workflow, so "I tested it by clicking Execute Workflow and nothing happened" isn't a bug in your setup, it's how it's documented to behave. Test it the same way it'll actually run: active, triggered for real.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Flip Active, then run exactly one real event through it
&lt;/h2&gt;

&lt;p&gt;Everything up to here has been deliberately artificial, pinned data, a forced error, a test execution. The last check is the opposite: let one genuinely real event through the live path and watch it end to end. &lt;a href="https://solutionscraft.com/automation/stripe-customers-to-google-sheet-n8n" rel="noopener noreferrer"&gt;An earlier post&lt;/a&gt; on syncing Stripe customers to a Google Sheet covers the same point from the deploy side: a workflow that only ever runs when you manually execute it in the editor hasn't proven it works unattended, because the &lt;strong&gt;Active&lt;/strong&gt; toggle, not the editor's Execute button, is what actually makes a trigger-based workflow respond to real traffic. Flip it on, then trigger or wait for exactly one genuine event, a real webhook call, a real scheduled run, and check the execution log, not just "did something happen," but did the right thing happen, with the right data, in the right place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where you've landed, and why it was worth the extra hour
&lt;/h2&gt;

&lt;p&gt;None of these five steps takes long on its own, pin a few branches, break a node on purpose, point an error workflow at it, run one real event. Together they're the difference between "I watched it run once" and "I know what it does when the data isn't cooperating," which is the actual question a client is trusting you to have answered before the workflow becomes their problem instead of yours. The next time you're tempted to skip straight from "the demo worked" to sending the handoff message, this is the hour that stands between those two things.&lt;/p&gt;

&lt;p&gt;If the client's own instance is one you're setting up rather than one that already exists, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; is worth considering for the handoff itself, since it means they're not also inheriting the hosting and upgrade side of things along with the workflow.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link, if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n's OAuth Endpoint Can Fill Your Disk</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 16 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8ns-oauth-endpoint-can-fill-your-disk-4cif</link>
      <guid>https://dev.to/thesolutionscraft/n8ns-oauth-endpoint-can-fill-your-disk-4cif</guid>
      <description>&lt;p&gt;An unauthenticated attacker doesn't need a login, a workflow-editor account, or even a valid n8n credential to make your database grow until it runs out of room. That's the entire point of the n8n OAuth client vulnerability patched on 30 September 2026: a flaw in how the instance's authorize endpoint persists OAuth clients lets anyone who can reach that endpoint create new database rows forever, with no permission check in the way. Rated High, tracked as &lt;a href="https://github.com/n8n-io/n8n/security/advisories/GHSA-3qcw-p65v-c7vq" rel="noopener noreferrer"&gt;GHSA-3qcw-p65v-c7vq&lt;/a&gt;, no CVE assigned as of publication.&lt;/p&gt;

&lt;p&gt;If that sounds different from the last two posts in this series, &lt;a href="https://solutionscraft.com/automation/audit-and-patch-n8n-sandbox-escape-vulnerability" rel="noopener noreferrer"&gt;the sandbox-escape bug from July&lt;/a&gt; and &lt;a href="https://solutionscraft.com/automation/n8n-fromai-sandbox-escape-patch" rel="noopener noreferrer"&gt;the &lt;code&gt;$fromAI&lt;/code&gt; prototype leak from August&lt;/a&gt;, it is. Both of those needed an authenticated account with permission to build or edit workflows before anything bad could happen. This one needs nothing but network access to the instance.&lt;/p&gt;

&lt;p&gt;This walkthrough is for &lt;strong&gt;self-hosted instances&lt;/strong&gt; you manage yourself, Docker or npm/pnpm. If you're on n8n Cloud, patching is handled for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who's affected
&lt;/h2&gt;

&lt;p&gt;Because there's no authentication check on the vulnerable path, exposure isn't about who has an account on your instance, it's about who can reach it over the network. If your instance is reachable from the open internet (or from any network you don't fully trust), you're exposed to an anonymous caller today, not a theoretical one who first needs stolen credentials.&lt;/p&gt;

&lt;p&gt;The advisory's technical detail is specific: the authorize endpoint resolves an OAuth client by its URL path, but then persists the caller's full, unmodified identifier, query string and all, as the database key. Two requests that differ only in an arbitrary query parameter produce two separate database rows. Those rows get marked as a trusted "first-party" client, which bypasses whatever registration caps would normally apply, and nothing enforces a size limit or an expiration on them. An attacker who just loops that request can keep growing your database indefinitely, no rate limit required on their end to make it hurt, until the disk it lives on fills up and takes workflow executions, logging, and anything else sharing that volume down with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Affected versions:&lt;/strong&gt; anything below &lt;code&gt;2.41.4&lt;/code&gt; on the stable line, plus &lt;code&gt;2.42.0&lt;/code&gt; specifically on the beta line. &lt;strong&gt;Patched versions:&lt;/strong&gt; &lt;code&gt;2.41.4&lt;/code&gt; (stable) and &lt;code&gt;2.42.1&lt;/code&gt; (beta).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; A denial-of-service bug that needs a login first is annoying. One that needs nothing but a URL is the kind that finds you whether or not you were ever planning to get around to patching this week.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need shell access to the machine (or container) running n8n, so you can check its version and, if needed, pull a new image or run an npm install. If you also want to check whether you've already taken a hit from this, you'll want access to wherever n8n's data actually lives: its data directory for SQLite, or your Postgres volume.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Check your installed version
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;npm/pnpm install:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n --version

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Docker:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;container-name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; n8n --version

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Check your instance for the OAuth client vulnerability
&lt;/h2&gt;

&lt;p&gt;Here the two currently-maintained lines split in an unusual way: the newer &lt;code&gt;2.42.0&lt;/code&gt; beta release is vulnerable even though it's numerically ahead of the &lt;code&gt;2.41.4&lt;/code&gt; stable patch, because &lt;code&gt;2.42.0&lt;/code&gt; shipped before &lt;code&gt;2.42.1&lt;/code&gt; fixed it on that line. Eyeballing one version number against one threshold misses that case, so this script checks both:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="c"&gt;# Checks an n8n version string against GHSA-3qcw-p65v-c7vq's affected ranges:&lt;/span&gt;
&lt;span class="c"&gt;# vulnerable: &amp;lt;2.41.4 OR exactly 2.42.0 (the beta release before 2.42.1 patched it)&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail

&lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${1:?Usage: check-n8n-version.sh &amp;lt;n8n-version&amp;gt;}"&lt;/span&gt;

ver_lt&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"$1"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"$2"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 1
  &lt;span class="nv"&gt;lower&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'%s\n%s\n'&lt;/span&gt; &lt;span class="s2"&gt;"$1"&lt;/span&gt; &lt;span class="s2"&gt;"$2"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sort -V &lt;span class="o"&gt;|&lt;/span&gt; head -n1&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"$lower"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"$1"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"$version"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2.42.0"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"VULNERABLE: $version is the 2.42.0 beta, which needs 2.42.1"&lt;/span&gt;
  &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="k"&gt;elif&lt;/span&gt; ver_lt &lt;span class="s2"&gt;"$version"&lt;/span&gt; &lt;span class="s2"&gt;"2.41.4"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"VULNERABLE: $version is below 2.41.4"&lt;/span&gt;
  &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"OK: $version is patched against GHSA-3qcw-p65v-c7vq"&lt;/span&gt;
&lt;span class="nb"&gt;exit&lt;/span&gt; 0

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save it as &lt;code&gt;check-n8n-version.sh&lt;/code&gt;, then pipe your actual version straight in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;chmod +x check-n8n-version.sh
./check-n8n-version.sh &lt;span class="s2"&gt;"$(n8n --version)"&lt;/span&gt;
&lt;span class="c"&gt;# or, for Docker:&lt;/span&gt;
./check-n8n-version.sh &lt;span class="s2"&gt;"$(docker exec &amp;lt;container-name&amp;gt; n8n --version)"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Patch
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Docker / Docker Compose&lt;/strong&gt; , pin the image tag to a patched version for whichever line you're on and redeploy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# docker-compose.yml
&lt;/span&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;n8n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;n8nio/n8n:2.41.4&lt;/span&gt; &lt;span class="c1"&gt;# or 2.42.1 if you're tracking the beta line
&lt;/span&gt;

&lt;span class="s"&gt;docker compose pull&lt;/span&gt;
&lt;span class="s"&gt;docker compose up -d&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;npm/pnpm global install:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g n8n@2.41.4

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Confirm the patch took
&lt;/h2&gt;

&lt;p&gt;Re-run the same check, it should now report &lt;code&gt;OK&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./check-n8n-version.sh &lt;span class="s2"&gt;"$(n8n --version)"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check whether you've already taken a hit
&lt;/h2&gt;

&lt;p&gt;Because this bug does its damage quietly, over time, in the background, before you patch is worth a quick look at whether it's already been happening to you. For a default SQLite setup, check the size of n8n's data directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;du -sh ~/.n8n
&lt;span class="c"&gt;# or, for Docker:&lt;/span&gt;
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;container-name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; du -sh /home/node/.n8n

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're on Postgres, check the database size directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nf"&gt;pg_size_pretty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;pg_database_size&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'n8n'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Neither command tells you &lt;em&gt;why&lt;/em&gt; a database is large on its own, a busy instance with years of execution history is large too, for perfectly normal reasons. What you're looking for is an unexplained jump, especially one with no corresponding jump in actual workflow activity. That mismatch is the pattern the advisory itself calls out as the thing to watch for.&lt;/p&gt;

&lt;h2&gt;
  
  
  What was actually happening
&lt;/h2&gt;

&lt;p&gt;The part worth understanding, not just patching around: this bug lives in how the authorize endpoint decides what counts as "the same" OAuth client. A correctly-scoped lookup would resolve a client by some stable identifier and treat two requests for that same identifier as one client, however many irrelevant query parameters get tacked onto the URL. This endpoint didn't do that. It took the caller's identifier exactly as sent, query string included, and used that whole string as the database key. Add a harmless, unused query parameter, and congratulations, you've just described a brand-new "client" as far as the database is concerned.&lt;/p&gt;

&lt;p&gt;That alone would be a nuisance. What makes it a real vulnerability is the second part: clients created this way get marked as first-party, a trust level that's meant for n8n's own internal clients and that skips the caps and limits a normal client registration would run into. No authentication gate, no size limit, no expiration, and a label that waves the request past whatever guardrails exist elsewhere. Put those three together and a single unauthenticated caller, in a tight loop, with no special tooling, turns into a disk-filling denial-of-service.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you can't upgrade right away
&lt;/h2&gt;

&lt;p&gt;n8n's own advisory lists a few stopgaps, worth repeating because none of them closes the hole on its own:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restrict network access to the instance to trusted users and systems only, rather than leaving it reachable from the open internet.&lt;/li&gt;
&lt;li&gt;Deactivate or reconfigure any workflows using &lt;strong&gt;Form Trigger&lt;/strong&gt; or &lt;strong&gt;Chat Trigger&lt;/strong&gt; nodes that use &lt;code&gt;n8nUserAuth&lt;/code&gt; authentication until you've patched, since that's the surface this vulnerable path sits behind.&lt;/li&gt;
&lt;li&gt;Monitor your database size for unexpected growth and set filesystem-level disk usage alerts, so you catch exploitation in progress rather than finding out when the disk is already full.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Treat all three as a stopgap, not a substitute for patching. The advisory is explicit that none of them fully remediates the risk.&lt;/p&gt;

&lt;p&gt;If keeping up with a bi-weekly cadence of advisories like this one isn't something you want to own yourself, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; hands this one, and every future one, to n8n's own team instead.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link, if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Check your version today, whether or not you remember building anything that touches OAuth. Unlike the last two advisories in this series, there's no "if you don't use AI Agent tools, this door isn't open to you" clause here, the only requirement is that your instance answers requests on a network someone else can reach. If you're already running the version checks from &lt;a href="https://solutionscraft.com/automation/audit-and-patch-n8n-sandbox-escape-vulnerability" rel="noopener noreferrer"&gt;the sandbox-escape post&lt;/a&gt; or &lt;a href="https://solutionscraft.com/automation/n8n-fromai-sandbox-escape-patch" rel="noopener noreferrer"&gt;the &lt;code&gt;$fromAI&lt;/code&gt; post&lt;/a&gt; as part of a regular routine, fold this one into the same habit rather than treating it as a one-off.&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>security</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n Backup and Restore, Done Right</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 16 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8n-backup-and-restore-done-right-4a11</link>
      <guid>https://dev.to/thesolutionscraft/n8n-backup-and-restore-done-right-4a11</guid>
      <description>&lt;p&gt;A backup you've never restored isn't a backup, it's a guess with a timestamp on it. That's the uncomfortable truth behind a popular r/n8n thread this autumn about losing workflows to a bad upgrade, with half the replies pointing at a paid backup-manager tool as the fix. You don't need one. n8n ships export and import commands for exactly this, and this n8n backup and restore routine uses nothing but those, a tarball, and one encryption key you keep somewhere safer than the server itself.&lt;/p&gt;

&lt;p&gt;This is part 4 of the site's self-hosting series. &lt;a href="https://solutionscraft.com/automation/move-n8n-npm-to-docker-before-v3" rel="noopener noreferrer"&gt;Part 1&lt;/a&gt; covered moving off npm before Docker became mandatory, &lt;a href="https://solutionscraft.com/automation/n8n-v3-storage-directory-rename-prep" rel="noopener noreferrer"&gt;part 2&lt;/a&gt; covered the v3 storage rename, and &lt;a href="https://solutionscraft.com/automation/self-host-n8n-docker-compose-https-setup" rel="noopener noreferrer"&gt;part 3&lt;/a&gt; built the Docker Compose setup this post assumes you're backing up. Everything below was run against a real n8n instance in this sandbox, including the restore, not assumed from the docs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; A backup you've never restored and a backup that doesn't exist look identical right up until the moment you need one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need shell access to the machine or container running n8n, and to know where your data directory and your &lt;code&gt;N8N_ENCRYPTION_KEY&lt;/code&gt; actually live. Nothing here needs a second server; the restore test runs against a throwaway instance you spin up just for this and delete afterward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Export your workflows
&lt;/h2&gt;

&lt;p&gt;n8n's CLI dumps every workflow to its own JSON file in one command, &lt;a href="https://solutionscraft.com/automation/n8n-vm-expression-engine-audit" rel="noopener noreferrer"&gt;already shown in this site's VM-engine audit&lt;/a&gt; for a different reason:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n export:workflow --all --separate --output=./backup/workflows/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran this against a real workflow created through the n8n API (not a hand-written stub) and confirmed it writes one file per workflow, named by the workflow's own ID, containing the full node graph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Export your credentials, carefully
&lt;/h2&gt;

&lt;p&gt;Same shape, different command, and one flag that matters a lot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n export:credentials --all --separate --output=./backup/credentials-encrypted/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without &lt;code&gt;--decrypted&lt;/code&gt;, each credential's &lt;code&gt;data&lt;/code&gt; field comes out as ciphertext, still locked to whatever &lt;code&gt;N8N_ENCRYPTION_KEY&lt;/code&gt; your instance is running. That's fine for a same-key restore, but I tested what happens when it isn't: I imported this exact encrypted export into a fresh instance running a &lt;em&gt;different&lt;/em&gt; key. The import itself reported success with no error at all, "Successfully imported 1 credential", nothing looked wrong. Only when I tried to actually use that credential (a decrypted re-export, in my test) did n8n say what had really happened: "Credentials could not be decrypted. The likely reason is that a different 'encryptionKey' was used to encrypt the data." The import doesn't fail loudly. It fails silently, and you find out later, which is exactly the scenario Step 4 exists to prevent.&lt;/p&gt;

&lt;p&gt;If you're deliberately moving to a new key, or you just want a format you can actually inspect, add &lt;code&gt;--decrypted&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n export:credentials --all --decrypted --separate --output=./backup/credentials-decrypted/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I confirmed this writes the real password in plain text in the JSON, which is exactly what the flag is for and exactly why the next step matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Never let the decrypted version anywhere near git
&lt;/h2&gt;

&lt;p&gt;The encrypted export from Step 2 is safe to commit, it's useless without your key. The decrypted one is a plaintext list of every password and API key your workflows use, and it needs to never touch a git history, including a private repo, including one you'll "clean up later." &lt;a href="https://solutionscraft.com/automation/audit-n8n-leaked-api-tokens" rel="noopener noreferrer"&gt;This site's post on leaked n8n API tokens&lt;/a&gt; covered exactly how a committed-then-deleted secret stays reachable in history forever, GitGuardian's 4,576 leaked tokens didn't get there by anyone trying to leak them. If you need the decrypted export at all (migrating to a new encryption key, auditing what a credential actually contains), write it to a path your &lt;code&gt;.gitignore&lt;/code&gt; already excludes, use it, and delete it. The encrypted export in Step 2 is your actual backup artifact.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Save the encryption key somewhere the server backup doesn't reach
&lt;/h2&gt;

&lt;p&gt;Every credential n8n has ever stored decrypts with exactly one key, &lt;code&gt;N8N_ENCRYPTION_KEY&lt;/code&gt;, whether you set it explicitly or n8n auto-generated one into its config file the first time it ran (check with the same pattern used in &lt;a href="https://solutionscraft.com/automation/move-n8n-npm-to-docker-before-v3" rel="noopener noreferrer"&gt;part 1 of this series&lt;/a&gt;: &lt;code&gt;grep -o '"encryptionKey":"[^"]*"' ~/.n8n/config&lt;/code&gt;). Step 2's silent-failure result is the whole argument for this step: an encrypted backup with a lost key isn't a backup, it's a very well-organized list of credentials nobody can ever read again. &lt;a href="https://solutionscraft.com/automation/n8n-fromai-sandbox-escape-patch" rel="noopener noreferrer"&gt;An earlier post in this series&lt;/a&gt; covered a sandbox-escape bug whose entire payoff was reaching this exact key, worth remembering that the key is both the thing you must never lose and the thing an attacker most wants.&lt;/p&gt;

&lt;p&gt;Write it down somewhere that isn't the server you're backing up and isn't the same backup archive as your credentials file. A password manager entry or a secrets vault both work. The one wrong answer is "it's fine, it's in the config file on the same disk as everything else," since that disk is exactly what you're protecting against losing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Back up the whole data directory too
&lt;/h2&gt;

&lt;p&gt;Workflow and credential exports cover what's in the database, but not everything n8n keeps lives there. Back up the data directory itself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tar -czf n8n-backup-&lt;span class="nv"&gt;$(&lt;/span&gt;date +%Y%m%d&lt;span class="o"&gt;)&lt;/span&gt;.tar.gz -C ~ .n8n

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're on Postgres rather than SQLite, add a &lt;code&gt;pg_dump&lt;/code&gt; of that database to the same backup; the &lt;code&gt;.n8n&lt;/code&gt; folder alone won't have your workflow and execution data in that setup. I ran the tar command above against a real, populated &lt;code&gt;.n8n&lt;/code&gt; directory (not a mock one) and confirmed the archive extracts cleanly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Prove the n8n backup and restore actually works
&lt;/h2&gt;

&lt;p&gt;This is the step the r/n8n thread's commenters were all skipping. I built a second, throwaway n8n instance from scratch, imported both exports into it, and checked the result end to end:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n import:workflow --separate --input=./backup/workflows/
n8n import:credentials --separate --input=./backup/credentials-encrypted/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workflow came back with the same node graph. The credential, imported on an instance running the &lt;em&gt;same&lt;/em&gt; key as the original, decrypted cleanly, I confirmed this by re-exporting it decrypted afterward and diffing the password against the original: identical, byte for byte. That's the version of "the backup works" worth trusting, not the version where the commands ran without printing an error.&lt;/p&gt;

&lt;p&gt;One gotcha worth knowing before you restore onto an instance that already has data on it: n8n's export keeps each workflow's and credential's original database ID, and importing a file whose ID already exists overwrites that row rather than creating a second one. I confirmed this by importing the same workflow file twice into the same instance, once is a clean import, the second time 'succeeds' with an identical message but there's still exactly one copy afterward, not two. For a disaster-recovery restore that's usually what you want. For a test like this one, do it on a throwaway instance, not your production one, so there's nothing it can collide with.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't cover
&lt;/h2&gt;

&lt;p&gt;n8n's own docs flag that these Server CLI commands (&lt;code&gt;export:workflow&lt;/code&gt;, &lt;code&gt;import:workflow&lt;/code&gt;, and their credential equivalents) are planned for eventual deprecation in favor of a newer &lt;code&gt;n8n CLI&lt;/code&gt; tool built around &lt;code&gt;.n8np&lt;/code&gt; package files, still in Preview as of this writing. The commands above are today's documented, stable path and the ones this post actually tested; if that newer tool graduates out of preview, it's worth a follow-up, but nothing here is at risk of disappearing without notice in the meantime.&lt;/p&gt;

&lt;p&gt;This also isn't a scheduling system. Run the export and tar commands by hand, or wire them into a cron job or a scheduled workflow (n8n can back up n8n, which is either elegant or a little too recursive, your call), but either way the schedule is on you; nothing in n8n triggers this automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Run Steps 1, 2, and 5 today, on whatever you're currently running, and store the key from Step 4 somewhere that survives the server dying. Then, before you trust any of it, do Step 6 once: spin up a throwaway instance, restore into it, and confirm a real credential actually decrypts. If you'd rather hand the whole backup question to someone else, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; puts backups, key management, and restores on n8n's own team instead of yours.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link, if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n's Storage Rename Can Block Your Upgrade</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 16 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8ns-storage-rename-can-block-your-upgrade-1bc</link>
      <guid>https://dev.to/thesolutionscraft/n8ns-storage-rename-can-block-your-upgrade-1bc</guid>
      <description>&lt;p&gt;n8n's v3 storage directory rename sounds like the kind of internal detail you can safely ignore: a folder gets a new name, n8n handles it, you move on. For most self-hosted instances that's exactly how it goes. But if you (or an old backup, or a half-finished migration attempt) ever left a &lt;code&gt;~/.n8n/storage&lt;/code&gt; folder sitting next to &lt;code&gt;~/.n8n/binaryData&lt;/code&gt;, n8n 3.x won't start at all until you sort that out, and you'll find out the hard way, mid-upgrade, with no workflow running. &lt;a href="https://solutionscraft.com/automation/move-n8n-npm-to-docker-before-v3" rel="noopener noreferrer"&gt;An earlier post in this series&lt;/a&gt; covered moving a self-hosted instance from npm to Docker before 3.0 lands; this one is the next prep step, and it's a five-minute check either way.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; A rename that happens automatically is great, right up until two folders both claim to be the destination.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;This applies to any self-hosted n8n instance, Docker or npm, that stores binary data on disk (the default, unless you've already pointed it at S3 or another external store). You'll need shell access to the machine or container running n8n, and to know your current n8n version. Nothing here touches a running instance; it's all read-only checks and, if needed, cleanup you do on your own schedule before you ever install 3.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Confirm the warning applies to you yet
&lt;/h2&gt;

&lt;p&gt;n8n started warning about this rename in version 2.39.6, released 2026-09-16, well ahead of the actual 3.0 release. If you're on an older version, you won't see anything about it yet, which isn't the same as being safe from it later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n &lt;span class="nt"&gt;--version&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since &lt;code&gt;sort -V&lt;/code&gt;'s version comparison has a few sharp edges (it has to get &lt;code&gt;2.4.0&lt;/code&gt; right as older than &lt;code&gt;2.39.6&lt;/code&gt;, not newer, and treat a &lt;code&gt;1.x&lt;/code&gt; release as older than any &lt;code&gt;2.x&lt;/code&gt; one even though &lt;code&gt;1.123&lt;/code&gt; looks like a bigger number), I wrote and ran this check against both edge cases plus the exact threshold version before trusting it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail
&lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nv"&gt;min&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2.39.6"&lt;/span&gt;
&lt;span class="nv"&gt;lowest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'%s\n%s\n'&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$version&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$min&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-V&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n1&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$lowest&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$min&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$version&lt;/span&gt;&lt;span class="s2"&gt;: WARNING-ELIGIBLE (on 2.39.6 or later, Migration Report check applies)"&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$version&lt;/span&gt;&lt;span class="s2"&gt;: TOO OLD (upgrade to at least 2.39.6 to see the Migration Report warning)"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run against &lt;code&gt;2.38.9&lt;/code&gt;, &lt;code&gt;2.39.5&lt;/code&gt;, &lt;code&gt;2.39.6&lt;/code&gt; itself, &lt;code&gt;2.39.7&lt;/code&gt;, the current &lt;code&gt;2.43.4&lt;/code&gt; stable, an old &lt;code&gt;1.123.84&lt;/code&gt;, and &lt;code&gt;2.4.0&lt;/code&gt; (the one most likely to trip up a naive string comparison), every one of them returned the correct verdict. If yours comes back "too old," the folder check in Step 2 still matters, since 3.0 will do the rename regardless of whether your current version warned you about it first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Check for a storage directory conflict now
&lt;/h2&gt;

&lt;p&gt;This is the actual failure mode worth catching early. n8n 3.x's first start renames &lt;code&gt;~/.n8n/binaryData&lt;/code&gt; to &lt;code&gt;~/.n8n/storage&lt;/code&gt; automatically, but if &lt;code&gt;~/.n8n/storage&lt;/code&gt; already exists too (an old manual experiment, a restored backup that unpacked both, a Docker volume that got merged from two sources), the startup migration can't tell which one is authoritative, reports an error, and the new version doesn't start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail
&lt;span class="nv"&gt;base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="p"&gt;/.n8n&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nv"&gt;old&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="s2"&gt;/binaryData"&lt;/span&gt;
&lt;span class="nv"&gt;new&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="s2"&gt;/storage"&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$old&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$new&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"CONFLICT: both &lt;/span&gt;&lt;span class="nv"&gt;$old&lt;/span&gt;&lt;span class="s2"&gt; and &lt;/span&gt;&lt;span class="nv"&gt;$new&lt;/span&gt;&lt;span class="s2"&gt; exist. n8n 3.x will refuse to start until you remove or merge one."&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$old&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"OK (pre-migration): &lt;/span&gt;&lt;span class="nv"&gt;$old&lt;/span&gt;&lt;span class="s2"&gt; exists, &lt;/span&gt;&lt;span class="nv"&gt;$new&lt;/span&gt;&lt;span class="s2"&gt; does not. The 3.x first start will rename it automatically."&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$new&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"OK (already migrated): &lt;/span&gt;&lt;span class="nv"&gt;$new&lt;/span&gt;&lt;span class="s2"&gt; exists, &lt;/span&gt;&lt;span class="nv"&gt;$old&lt;/span&gt;&lt;span class="s2"&gt; does not."&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"NEITHER FOUND: check N8N_STORAGE_PATH / N8N_BINARY_DATA_STORAGE_PATH for a custom path instead."&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran this against four mock directory layouts, binaryData only, both present, storage only, and neither, and it correctly identified the conflict case and left the other three alone. If you're on Docker, point &lt;code&gt;base&lt;/code&gt; at wherever your volume mounts inside the container (&lt;code&gt;/home/node/.n8n&lt;/code&gt; in the compose file from the npm-to-Docker post) rather than your host's home directory.&lt;/p&gt;

&lt;p&gt;If Step 2 reports a conflict, resolve it before you go anywhere near a 3.0 install: decide which folder actually has your current binary data (check file timestamps and sizes, the real one will be the larger, more recently-touched one in an active instance), back up the other, and remove it. Guessing wrong here means losing binary attachments from workflow executions, so don't rush this part.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Decide whether to let the rename happen automatically, or control it yourself
&lt;/h2&gt;

&lt;p&gt;If Step 2 came back clean, you have two honest options, and neither is wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Do nothing, and let 3.0's first start rename it for you.&lt;/strong&gt; This is the default path and it's fine if your setup is simple (one instance, one data directory, no custom storage path already in play).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set &lt;code&gt;N8N_STORAGE_PATH&lt;/code&gt; explicitly now&lt;/strong&gt; , pointing at wherever you want binary data to live going forward. Doing this ahead of time removes the automatic rename rule from the Migration Report entirely (per the rule's own skip condition), which is worth doing if you're also restructuring your Docker volumes or moving to a new host as part of this upgrade anyway, since you'd rather make that change deliberately than rely on an automatic rename landing in the right place.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Either way, if you're on Docker, update your volume mount comment or documentation to reflect the new path once you've upgraded. The mount itself doesn't need to change (it's still mapped to the parent &lt;code&gt;.n8n&lt;/code&gt; directory), but anyone who reads your compose file later and goes looking for &lt;code&gt;binaryData&lt;/code&gt; inside it will come up empty after the rename, worth a one-line note so that's not a mystery six months from now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Clear the other 2.39.6 warning while you're in here
&lt;/h2&gt;

&lt;p&gt;The same release that added the storage-rename warning also started flagging a second, unrelated deprecation: the &lt;code&gt;N8N_DB_PING_TIMEOUT&lt;/code&gt; environment variable, renamed to &lt;code&gt;DB_PING_TIMEOUT_MS&lt;/code&gt; back in an earlier release, with the old name's fallback slated for removal entirely in 3.x. If you set the old name anywhere, n8n still honors it today but prints a warning on every startup, and that fallback won't exist once you're on 3.0:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="s1"&gt;'^N8N_DB_PING_TIMEOUT='&lt;/span&gt; .env &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"FOUND legacy var, needs rename"&lt;/span&gt;
&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/^N8N_DB_PING_TIMEOUT=/DB_PING_TIMEOUT_MS=/'&lt;/span&gt; .env

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran both lines against a mock &lt;code&gt;.env&lt;/code&gt; file containing &lt;code&gt;N8N_ENCRYPTION_KEY&lt;/code&gt;, &lt;code&gt;N8N_DB_PING_TIMEOUT&lt;/code&gt;, and &lt;code&gt;N8N_HOST&lt;/code&gt;, the grep caught the legacy name and the &lt;code&gt;sed&lt;/code&gt; renamed only that one line, leaving the other two untouched. Most instances don't set this variable at all (it only matters if you've tuned database connection timeouts manually), so an empty result from the &lt;code&gt;grep&lt;/code&gt; is the normal, expected outcome, not a sign something's missing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you upgrade to 3.0
&lt;/h2&gt;

&lt;p&gt;Run Step 1 and Step 2 today, they take longer to read about than to actually run. If Step 2 comes back clean and you're fine letting the rename happen on its own, you genuinely don't need to do anything else before 3.0 ships, this whole post was the five minutes of due diligence that lets you upgrade without thinking about storage paths at all. If it flags a conflict, resolve that now, on your own schedule, rather than the first time you try to start 3.0 and it won't come up. Either way, this and the npm-to-Docker move from the first post in this series are both things worth finishing before you touch the version number itself, not during the same change where a problem in one is hard to tell apart from a problem in the other.&lt;/p&gt;

&lt;p&gt;If you'd rather not track breaking-change prep like this yourself going forward, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; puts storage paths, deprecations, and upgrade timing on n8n's own team instead of yours.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link, if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n Docker Compose Setup, Done the Safe Way</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 16 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8n-docker-compose-setup-done-the-safe-way-2bhb</link>
      <guid>https://dev.to/thesolutionscraft/n8n-docker-compose-setup-done-the-safe-way-2bhb</guid>
      <description>&lt;p&gt;Ask around for an n8n Docker Compose setup and you'll get five different answers, half of them missing HTTPS entirely, a couple with no persistent volume at all (great, until the container gets recreated and every workflow is gone), and none of them telling you how to update without crossing your fingers. None of that is because self-hosting n8n is hard. It's because most walkthroughs stop at &lt;code&gt;docker compose up -d&lt;/code&gt; and call it done, when the real setup is three smaller problems stacked on top of each other: getting traffic to the container securely, making sure your data actually survives a restart, and updating later without finding out the hard way that you didn't.&lt;/p&gt;

&lt;p&gt;This is part 3 of the site's self-hosting series. &lt;a href="https://solutionscraft.com/automation/move-n8n-npm-to-docker-before-v3" rel="noopener noreferrer"&gt;Part 1&lt;/a&gt; covered moving an existing npm install to Docker before n8n 3.0 drops npm support; &lt;a href="https://solutionscraft.com/automation/n8n-v3-storage-directory-rename-prep" rel="noopener noreferrer"&gt;part 2&lt;/a&gt; covered the storage-directory rename that comes with it. This post is for starting from zero: a from-scratch Compose setup with HTTPS, a volume that actually persists, and an update routine you can trust because you've tested it, not because it sounds plausible.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; A docker-compose.yml with no named volume isn't a setup. It's a very elaborate way to lose data on a schedule.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need a server with Docker and the Compose plugin installed, a domain name with an A record pointed at that server's IP, and ports 80 and 443 open in whatever firewall sits in front of it. You don't need a specific VPS provider, any box that can run Docker and receive inbound traffic on those two ports works. If you'd rather skip owning the server entirely, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; puts HTTPS, updates, and backups on n8n's own team instead of yours; the rest of this post is for when you want to run it yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Write the n8n Docker Compose setup
&lt;/h2&gt;

&lt;p&gt;Two services: n8n itself, and Caddy in front of it handling HTTPS. Caddy gets the public ports; n8n stays off the public internet entirely and only talks to Caddy over the internal Docker network.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# docker-compose.yml&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;n8n&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.io/n8nio/n8n:2.43.7&lt;/span&gt; &lt;span class="c1"&gt;# pin to a specific tag, never :latest&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_HOST=${N8N_HOST}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_PROTOCOL=https&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;WEBHOOK_URL=https://${N8N_HOST}/&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_LISTEN_ADDRESS=0.0.0.0&lt;/span&gt;
    &lt;span class="na"&gt;expose&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5678"&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;n8n_data:/home/node/.n8n&lt;/span&gt;

  &lt;span class="na"&gt;caddy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;caddy:2-alpine&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_HOST=${N8N_HOST}&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;80:80"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;443:443"&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./Caddyfile:/etc/caddy/Caddyfile&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;caddy_data:/data&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;caddy_config:/config&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;n8n&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;n8n_data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;caddy_data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;caddy_config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things in there are worth calling out, because I only found them by actually running this, not by reading about it.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;N8N_LISTEN_ADDRESS=0.0.0.0&lt;/code&gt; line isn't decoration. n8n's default listen address is &lt;code&gt;::&lt;/code&gt;, the IPv6 wildcard, and plenty of Docker hosts (this one included, when I first tested without that line) don't have IPv6 enabled on the default bridge network. Without it, n8n crashes on startup with &lt;code&gt;n8n's address '::' is not available&lt;/code&gt;, and you're left debugging a networking problem that's actually a one-line environment variable. I hit this exact crash in testing and confirmed the fix starts it cleanly.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;environment: - N8N_HOST=${N8N_HOST}&lt;/code&gt; line under &lt;code&gt;caddy&lt;/code&gt;, not just under &lt;code&gt;n8n&lt;/code&gt;, is also not optional. A &lt;code&gt;.env&lt;/code&gt; file next to a Compose file only gets used for variable substitution &lt;em&gt;inside the Compose file itself&lt;/em&gt;; it isn't automatically injected into every container's runtime environment. Leave that line off the &lt;code&gt;caddy&lt;/code&gt; service and the &lt;code&gt;${N8N_HOST}&lt;/code&gt; placeholder you're about to write into the Caddyfile resolves to nothing, Caddy's config fails to parse into a valid site block, and you get silence from the reverse proxy with nothing obviously wrong in &lt;code&gt;docker compose ps&lt;/code&gt;. I reproduced this myself before adding that line: a working n8n container and a broken 502 from Caddy on every request, for exactly this reason.&lt;/p&gt;

&lt;p&gt;Keep your real &lt;code&gt;N8N_ENCRYPTION_KEY&lt;/code&gt; and &lt;code&gt;N8N_HOST&lt;/code&gt; in a &lt;code&gt;.env&lt;/code&gt; file next to the Compose file, not hardcoded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;N8N_ENCRYPTION_KEY=generate-this-once-and-never-change-it
N8N_HOST=n8n.yourdomain.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate the key once with &lt;code&gt;openssl rand -hex 32&lt;/code&gt; the first time you ever run this, and never regenerate it afterward. Every credential n8n has ever encrypted is only decryptable with that exact key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Point Caddy at it for HTTPS
&lt;/h2&gt;

&lt;p&gt;Caddy's whole pitch is that getting HTTPS right is its job, not yours. The Caddyfile is three lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;# Caddyfile
&lt;/span&gt;{$&lt;span class="n"&gt;N8N_HOST&lt;/span&gt;} {
  &lt;span class="n"&gt;reverse_proxy&lt;/span&gt; &lt;span class="n"&gt;n8n&lt;/span&gt;:&lt;span class="m"&gt;5678&lt;/span&gt;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a real domain pointed at the server, Caddy requests and renews a Let's Encrypt certificate automatically on first start, no certbot, no cron job, no manual renewal, ever. That automatic-certificate behavior needs a real public domain and open ports 80/443 to work, which this sandbox doesn't have, so I couldn't test the live Let's Encrypt issuance end to end here. What I could test, and did, is the reverse proxy mechanics underneath it: I ran the same Caddyfile with &lt;code&gt;tls internal&lt;/code&gt; added (Caddy's own local CA, used for exactly this kind of offline test) in front of a real running n8n container, and confirmed the whole chain works, TLS handshake, HTTP/2, and a &lt;code&gt;200&lt;/code&gt; response from n8n's login page through the proxy. The only part Caddy swaps in production is where the certificate comes from; the proxying itself is the same code path either way, and that part is verified, not assumed.&lt;/p&gt;

&lt;p&gt;Bring it up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Give it a few seconds on first start (n8n runs its database migrations before it starts listening), then visit &lt;code&gt;https://n8n.yourdomain.com&lt;/code&gt;. If you get a connection refused instead of a slow load, check the Caddy container's logs first; a malformed Caddyfile or a missing &lt;code&gt;N8N_HOST&lt;/code&gt; on the &lt;code&gt;caddy&lt;/code&gt; service (see Step 1) is the usual cause.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Prove the data survives, don't assume it
&lt;/h2&gt;

&lt;p&gt;A named volume is only "persistent" if you've actually checked that it is. I tore down and recreated the containers (not the volumes) and compared file checksums before and after:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose &lt;span class="nb"&gt;exec &lt;/span&gt;n8n &lt;span class="nb"&gt;md5sum&lt;/span&gt; /home/node/.n8n/config /home/node/.n8n/database.sqlite
docker compose down
docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
docker compose &lt;span class="nb"&gt;exec &lt;/span&gt;n8n &lt;span class="nb"&gt;md5sum&lt;/span&gt; /home/node/.n8n/config /home/node/.n8n/database.sqlite

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both checksums matched exactly, before and after. That's the actual guarantee &lt;code&gt;docker compose down&lt;/code&gt; (without &lt;code&gt;-v&lt;/code&gt;) is supposed to give you: it removes containers, not the named volumes they mounted. &lt;code&gt;docker compose down -v&lt;/code&gt; removes volumes too, so don't reach for it out of habit when you just mean to restart.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Back up, and prove the backup works by restoring it
&lt;/h2&gt;

&lt;p&gt;A backup you've never restored is a guess. The backup itself is a one-liner against the named volume:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; n8n_data:/data &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:/backup alpine &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-czf&lt;/span&gt; /backup/n8n-backup-&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y%m%d&lt;span class="si"&gt;)&lt;/span&gt;.tar.gz &lt;span class="nt"&gt;-C&lt;/span&gt; /data &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran this against a live volume, then restored that exact archive into a brand-new, empty volume and compared checksums against the original:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker volume create n8n_restore_test
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; n8n_restore_test:/data &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:/backup alpine &lt;span class="se"&gt;\&lt;/span&gt;
  sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"tar -xzf /backup/n8n-backup-20261016.tar.gz -C /data &amp;amp;&amp;amp; chown -R 1000:1000 /data"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every file matched, byte for byte, which is the only version of "the backup works" worth trusting. A future post in this series covers backup strategy in more depth, including where the encryption key fits into a restore and how to automate this on a schedule; for now, know that the command above produces a restorable archive, because I restored it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Update without crossing your fingers
&lt;/h2&gt;

&lt;p&gt;Updating is the same shape every time: back up, change the pinned tag, bring the one service up again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Back up first (Step 4's command)&lt;/span&gt;
&lt;span class="c"&gt;# 2. Edit docker-compose.yml: bump the n8n image tag to the version you've checked the changelog for&lt;/span&gt;
&lt;span class="c"&gt;# 3. Pull and recreate only the n8n service&lt;/span&gt;
docker compose pull n8n
docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt; n8n

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pinning to an exact tag, rather than &lt;code&gt;:latest&lt;/code&gt;, means an update only happens when you change that one line, not whenever Docker happens to re-pull the image. If something breaks after an update, you have the backup from step 2 and the previous tag still sitting in your Compose file's git history to roll back to. Check the n8n &lt;a href="https://docs.n8n.io/changelog/release-notes" rel="noopener noreferrer"&gt;release notes&lt;/a&gt; for breaking changes before bumping more than one minor version at a time, especially around the 3.0 line this series has been tracking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Run Steps 1 through 4 on a throwaway VPS before you ever point real workflows at this. Confirm HTTPS loads, confirm the checksum test in Step 3 actually matches, and confirm you can restore your own backup, not just create one. Once all three of those are true, you have a setup worth trusting with production credentials, not just one that happened to boot.&lt;/p&gt;

&lt;p&gt;If you outgrow this single-container shape later, high execution volume, multiple heavy workflows competing for CPU, n8n's queue mode splits the work across separate worker containers behind the same Postgres database. That's a real architecture change, not a Compose tweak, so treat it as a "when you actually need it" problem rather than something to build in from day one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link, if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n Invoice PDF Generation, No Duplicates</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 09 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8n-invoice-pdf-generation-no-duplicates-53n3</link>
      <guid>https://dev.to/thesolutionscraft/n8n-invoice-pdf-generation-no-duplicates-53n3</guid>
      <description>&lt;p&gt;The n8n invoice PDF generation demo everyone builds first is the same five minutes: a trigger, a template, an email. It works great in the editor, right up until a flaky connection makes your order system retry the same webhook, and your customer gets the same invoice twice, or a PDF service hiccups for one request and the email step just... doesn't send, with nothing telling you it didn't. The happy path was never the hard part here. Making it survive a retry, a slow dependency, or a bad payload without either duplicating or silently vanishing is.&lt;/p&gt;

&lt;p&gt;This walkthrough builds that version: webhook in, validated and deduplicated, PDF rendered by a self-hosted converter, emailed with the PDF attached, and every outcome (sent or failed) logged somewhere you'll actually see it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need an n8n instance (self-hosted works best for this one, since Step 4 runs a small companion container alongside it, though a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; will still run everything except that container), SMTP credentials for the Send Email node, and a Google Sheet to act as the invoice ledger (columns: &lt;code&gt;idempotencyKey&lt;/code&gt;, &lt;code&gt;orderId&lt;/code&gt;, &lt;code&gt;customerEmail&lt;/code&gt;, &lt;code&gt;total&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;errorMessage&lt;/code&gt;, &lt;code&gt;updatedAt&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link — if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 1: Validate the payload and generate an idempotency key
&lt;/h2&gt;

&lt;p&gt;Add a &lt;strong&gt;Webhook&lt;/strong&gt; node (&lt;code&gt;POST&lt;/code&gt;, path &lt;code&gt;/invoice&lt;/code&gt;) as the trigger, then a &lt;strong&gt;Code&lt;/strong&gt; node right after it. This is the only node in the workflow doing real logic, so it's worth getting right: it checks the incoming payload has everything an invoice needs, totals the line items in integer cents rather than raw floats (the standard defensive habit in anything handling money, even though it rarely bites at normal 2-decimal invoice amounts), and derives a stable &lt;code&gt;idempotencyKey&lt;/code&gt; by hashing the order ID. That key is what Step 2 checks before generating anything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;crypto&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toCents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;missing orderId&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customerEmail&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;missing customerEmail&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lineItems must be a non-empty array&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`lineItems[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] missing description`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`lineItems[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] quantity must be &amp;gt; 0`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unitPrice&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`lineItems[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] unitPrice must be &amp;gt;= 0`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;totalCents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lineItems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lineCents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;toCents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unitPrice&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;totalCents&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;lineCents&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lineTotal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lineCents&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;idempotencyKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sha256&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hex&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;
  &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;idempotencyKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;customerEmail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customerEmail&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;totalCents&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}];&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wrote this as a plain Node script first and ran it against a normal multi-line invoice, a repeat of the same order ID (confirming it hashes to the same key both times), a payload missing required fields, and a line item with a zero quantity and a negative price. All four cases returned exactly what they should: correct totals, a matching key on the repeat, and the right error list on the two bad payloads. The version above is a direct port of that logic into n8n's expression context (&lt;code&gt;$input.first().json.body&lt;/code&gt; instead of a function argument), not a rewrite, though the live n8n execution itself isn't something this sandbox can run.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; require("crypto") works out of the box on n8n Cloud. Self-hosted, it doesn't, until you set NODE_FUNCTION_ALLOW_BUILTIN=crypto (or =* for every built-in module) on the instance. Find that out before your first real invoice, not during it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Add an &lt;strong&gt;IF&lt;/strong&gt; node after the Code node checking &lt;code&gt;{{ $json.ok }}&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;. Wire the &lt;code&gt;false&lt;/code&gt; branch to a &lt;strong&gt;Respond to Webhook&lt;/strong&gt; node set to a &lt;code&gt;400&lt;/code&gt; status with &lt;code&gt;{{ $json.errors }}&lt;/code&gt; as the body, so a malformed order fails loudly and immediately instead of limping further into the workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Check the ledger before you generate anything
&lt;/h2&gt;

&lt;p&gt;This is the step that actually prevents the double-send. Add a &lt;strong&gt;Google Sheets&lt;/strong&gt; node set to &lt;strong&gt;Get Row(s)&lt;/strong&gt;, pointed at your ledger sheet, filtered on &lt;code&gt;idempotencyKey&lt;/code&gt; equal to &lt;code&gt;{{ $json.idempotencyKey }}&lt;/code&gt;. Follow it with an &lt;strong&gt;IF&lt;/strong&gt; node checking whether any row came back.&lt;/p&gt;

&lt;p&gt;If a row exists, this exact order has already been processed, so wire that branch straight to a &lt;strong&gt;Respond to Webhook&lt;/strong&gt; node (&lt;code&gt;200&lt;/code&gt;, body like &lt;code&gt;{"status": "already processed"}&lt;/code&gt;) and stop there, no PDF, no second email. If nothing came back, continue to Step 3. This is what makes a retried webhook safe: the order system doesn't know or care that it sent the same request twice, but your workflow does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Build the invoice HTML
&lt;/h2&gt;

&lt;p&gt;Add another &lt;strong&gt;Code&lt;/strong&gt; node that turns the validated data from Step 1 into a plain HTML string. Keep this simple and self-contained, since it's the input to the PDF conversion in the next step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;invoice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineItems&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`
    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/td&amp;gt;
      &amp;lt;td style="text-align:right"&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/td&amp;gt;
      &amp;lt;td style="text-align:right"&amp;gt;$&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unitPrice&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/td&amp;gt;
      &amp;lt;td style="text-align:right"&amp;gt;$&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineTotal&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;`&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta charset="utf-8" /&amp;gt;&amp;lt;style&amp;gt;
body { font-family: sans-serif; padding: 32px; }
table { width: 100%; border-collapse: collapse; margin-top: 24px; }
th, td { padding: 8px; border-bottom: 1px solid #ddd; }
th { text-align: left; }
.total { text-align: right; font-weight: bold; margin-top: 16px; }
&amp;lt;/style&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;Invoice &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/h1&amp;gt;
  &amp;lt;p&amp;gt;Billed to: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customerEmail&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
  &amp;lt;table&amp;gt;
    &amp;lt;thead&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Description&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Qty&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Unit price&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Line total&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/thead&amp;gt;
    &amp;lt;tbody&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/tbody&amp;gt;
  &amp;lt;/table&amp;gt;
  &amp;lt;p class="total"&amp;gt;Total: $&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran this one too, against the same three-line-item invoice from Step 1's test, and checked the output has exactly one &lt;code&gt;&amp;lt;tr&amp;gt;&lt;/code&gt; per line item plus the correct total string rendered in the markup. Both checks passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: n8n invoice PDF generation with Gotenberg
&lt;/h2&gt;

&lt;p&gt;Now turn that HTML string into an actual binary PDF file. Add a &lt;strong&gt;Convert to File&lt;/strong&gt; node, operation &lt;strong&gt;Text File&lt;/strong&gt; , &lt;strong&gt;Text Input Field&lt;/strong&gt; set to &lt;code&gt;html&lt;/code&gt;, and &lt;strong&gt;File Name&lt;/strong&gt; set to &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; The Convert to File node also has an operation literally called "HTML." Tempting, but it builds an HTML table out of your JSON, it doesn't wrap an existing HTML string into a file. "Text File" with the name forced to index.html is the one that does what you actually want here.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For the conversion itself, run &lt;a href="https://gotenberg.dev/" rel="noopener noreferrer"&gt;Gotenberg&lt;/a&gt; as a small companion container next to n8n, it's an open-source, self-hosted HTML-to-PDF service with no API key or account needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; gotenberg &lt;span class="nt"&gt;-p&lt;/span&gt; 3000:3000 gotenberg/gotenberg:8

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add an &lt;strong&gt;HTTP Request&lt;/strong&gt; node: &lt;code&gt;POST http://gotenberg:3000/forms/chromium/convert/html&lt;/code&gt; (use the container name instead of &lt;code&gt;localhost&lt;/code&gt; if n8n and Gotenberg share a Docker network), Body Content Type &lt;strong&gt;Multipart Form-Data&lt;/strong&gt; , with one form field named &lt;code&gt;files&lt;/code&gt; set to send the binary data from the Convert to File node. Gotenberg specifically requires the HTML file be named &lt;code&gt;index.html&lt;/code&gt;, which is exactly what Step 4's &lt;strong&gt;File Name&lt;/strong&gt; setting sets it to.&lt;/p&gt;

&lt;p&gt;On this node's &lt;strong&gt;Settings&lt;/strong&gt; tab, turn on &lt;strong&gt;Retry On Fail&lt;/strong&gt; (3 tries, ~2000ms between them), a one-off timeout on the PDF service shouldn't kill the whole invoice. Set &lt;strong&gt;On Error&lt;/strong&gt; to &lt;strong&gt;Continue (using error output)&lt;/strong&gt; rather than the default &lt;strong&gt;Stop Workflow&lt;/strong&gt; , so a conversion that keeps failing routes to a separate branch instead of just halting silently. Wire that error output to Step 6's failure logging.&lt;/p&gt;

&lt;p&gt;I don't have a working Docker daemon in this sandbox to run the container end-to-end, so the request shape above is cross-checked against Gotenberg's own documented route and example curl command, not executed here. The Code node logic feeding it, and the HTML it produces, was executed and verified as described in Steps 1 and 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Send it, and don't let a failure disappear
&lt;/h2&gt;

&lt;p&gt;Add a &lt;strong&gt;Send Email&lt;/strong&gt; node using an SMTP credential, attaching the PDF from the Gotenberg response as a binary attachment. Configure the same &lt;strong&gt;Retry On Fail&lt;/strong&gt; (3 tries, ~2000ms) and &lt;strong&gt;On Error: Continue (using error output)&lt;/strong&gt; settings as Step 4, and wire its error output to the same failure branch. An SMTP server that's briefly unreachable is common enough that it deserves a retry before you give up on it, and a permanent failure deserves a row in the ledger, not a workflow that just stops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Log the outcome, either way
&lt;/h2&gt;

&lt;p&gt;On the success path (PDF converted and emailed), add a &lt;strong&gt;Google Sheets&lt;/strong&gt; node set to &lt;strong&gt;Append or Update Row&lt;/strong&gt; , matching on &lt;code&gt;idempotencyKey&lt;/code&gt;, writing &lt;code&gt;orderId&lt;/code&gt;, &lt;code&gt;customerEmail&lt;/code&gt;, &lt;code&gt;total&lt;/code&gt;, &lt;code&gt;status: "sent"&lt;/code&gt;, and a timestamp. Follow it with a &lt;strong&gt;Respond to Webhook&lt;/strong&gt; node returning &lt;code&gt;200&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the failure branch from either Step 4 or Step 5's error output, add the same &lt;strong&gt;Append or Update Row&lt;/strong&gt; setup, but with &lt;code&gt;status: "failed"&lt;/code&gt; and the error message from &lt;code&gt;{{ $json.error.message }}&lt;/code&gt;, then a &lt;strong&gt;Respond to Webhook&lt;/strong&gt; node returning &lt;code&gt;502&lt;/code&gt; so the caller's own retry logic knows this attempt genuinely didn't succeed, distinct from the &lt;code&gt;200&lt;/code&gt; "already processed" response in Step 2.&lt;/p&gt;

&lt;p&gt;That per-node error handling covers the PDF and email calls specifically, but it can't catch everything, a malformed webhook body that crashes the Step 1 Code node before it ever returns, for instance. For that, build a second, tiny workflow with just an &lt;strong&gt;Error Trigger&lt;/strong&gt; node, then in this workflow's own &lt;strong&gt;Options &amp;gt; Settings &amp;gt; Error workflow&lt;/strong&gt; , select it. Whatever slips past the branches above still lands somewhere you'll see it, with the failed execution's own link attached.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't solve
&lt;/h2&gt;

&lt;p&gt;The dedup check in Step 2 has a real race condition: if the exact same webhook fires twice within milliseconds of each other, both executions can read "no matching row" before either one finishes writing its own, and you'd still get a duplicate. This setup closes the common case (a retry seconds or minutes later, which is what actually happens with flaky connections and queued webhooks), not a genuine simultaneous double-fire, that needs a proper database with a unique constraint on &lt;code&gt;idempotencyKey&lt;/code&gt;, which a spreadsheet can't enforce. An SMTP server accepting the message for delivery also isn't the same thing as it reaching an inbox, a hard bounce still needs its own handling (typically a webhook from your email provider) if you want to know about it here rather than in your provider's dashboard. And none of this retries automatically if the Gotenberg container itself is down for an extended stretch, that shows up as a string of &lt;code&gt;failed&lt;/code&gt; rows in the ledger, worth a glance rather than something this workflow tries to page you about on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Build Steps 1 and 2 first and send the workflow a handful of test payloads, including the same &lt;code&gt;orderId&lt;/code&gt; twice, before you wire up anything that touches a real inbox. Once the ledger is correctly catching duplicates and rejecting bad payloads, add the PDF and email steps, and test with your own address a few times before pointing it at an actual customer. The failure branch is the one part of this worth deliberately triggering yourself, stop the Gotenberg container for a minute and send a test invoice, and confirm a &lt;code&gt;failed&lt;/code&gt; row shows up rather than nothing at all.&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n LinkedIn Outreach Automation, Safely</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 09 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8n-linkedin-outreach-automation-safely-4pea</link>
      <guid>https://dev.to/thesolutionscraft/n8n-linkedin-outreach-automation-safely-4pea</guid>
      <description>&lt;p&gt;Personalizing fifty LinkedIn connection requests by hand eats a whole morning and still looks like you rushed the last ten. n8n LinkedIn outreach automation fixes the scale problem: pull a prospect list from a sheet, have an AI node draft a short note from each person's real profile, send the invite, and log who actually connects, no tab-switching required. The part that trips people up isn't the workflow, it's that n8n has no outreach node to drag onto the canvas for this, because LinkedIn's own API doesn't allow it.&lt;/p&gt;

&lt;p&gt;That's not a dead end, it's just a different foundation. &lt;a href="https://www.unipile.com/" rel="noopener noreferrer"&gt;Unipile&lt;/a&gt; is a paid API that already did the work of talking to LinkedIn the way its own apps do, and n8n's generic &lt;strong&gt;HTTP Request&lt;/strong&gt; node calls it like any other API. This walkthrough builds the invite-and-track loop on that foundation, with the actual hard part, pacing it so your account doesn't get flagged, built in from the start rather than bolted on after a scare.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need an n8n instance (a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; works fine here), a paid &lt;a href="https://www.unipile.com/" rel="noopener noreferrer"&gt;Unipile&lt;/a&gt; account with your LinkedIn account connected through it, a Google Sheet to hold your prospect list, and a Chat Model credential (OpenAI, Anthropic, whichever you already use elsewhere in n8n) for the message-writing step.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link — if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Worth saying plainly before you build anything: LinkedIn's User Agreement prohibits automated use of the platform, and Unipile works by replicating what LinkedIn's own apps do rather than through a blessed partner API. Paced sensibly it looks like a genuinely active user; pushed hard it's how accounts get restricted. Treat the pacing numbers later in this post as load-bearing, not optional reading.&lt;/p&gt;

&lt;p&gt;Your sheet needs a column for each of: &lt;code&gt;Name&lt;/code&gt;, &lt;code&gt;ProfileUrl&lt;/code&gt;, &lt;code&gt;ProviderId&lt;/code&gt;, &lt;code&gt;Headline&lt;/code&gt;, &lt;code&gt;Status&lt;/code&gt;, &lt;code&gt;Note&lt;/code&gt;, &lt;code&gt;InvitedDate&lt;/code&gt;, &lt;code&gt;ConnectedDate&lt;/code&gt;. Every new prospect starts with &lt;code&gt;Status&lt;/code&gt; set to &lt;code&gt;Pending&lt;/code&gt; and everything else blank, since the workflow fills in the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Connect your LinkedIn account to Unipile
&lt;/h2&gt;

&lt;p&gt;Unipile's &lt;strong&gt;Hosted Auth Wizard&lt;/strong&gt; is the fastest way to link an account: one API call generates a short-lived URL, you open it and log into LinkedIn as you normally would, and Unipile hands back an &lt;code&gt;account_id&lt;/code&gt; tied to that login on a callback URL you configure (&lt;code&gt;notify_url&lt;/code&gt;, alongside &lt;code&gt;type: "create"&lt;/code&gt; and &lt;code&gt;providers: ["LINKEDIN"]&lt;/code&gt; in the request body, per Unipile's own docs). Since this workflow only ever drives one LinkedIn account, the simplest place to keep that &lt;code&gt;account_id&lt;/code&gt; is as a literal value pasted directly into the two HTTP Request nodes below, rather than threading it through every item, because every request from here on needs it.&lt;/p&gt;

&lt;p&gt;I don't have a live Unipile account in this sandbox to actually run this step against, so this part is docs-cross-checked against Unipile's hosted-auth reference, not executed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Pull today's batch from the sheet
&lt;/h2&gt;

&lt;p&gt;Add a &lt;strong&gt;Schedule Trigger&lt;/strong&gt; (once a day, e.g. 9am) feeding into a &lt;strong&gt;Google Sheets&lt;/strong&gt; node set to &lt;strong&gt;Get Row(s)&lt;/strong&gt;, filtered to &lt;code&gt;Status&lt;/code&gt; = &lt;code&gt;Pending&lt;/code&gt;. Follow it with a &lt;strong&gt;Code&lt;/strong&gt; node that caps how many you'll actually process today, which is the first line of defense against blowing past LinkedIn's daily ceiling, covered in full below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DAILY_CAP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// start low; see the pacing section before raising this&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;batch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rows&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pending&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;DAILY_CAP&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran this filter-and-cap logic standalone against a mixed list of &lt;code&gt;Pending&lt;/code&gt;/&lt;code&gt;Invited&lt;/code&gt;/&lt;code&gt;Connected&lt;/code&gt; rows: it returns only the pending ones, respects the cap when there are more pending rows than the cap allows, and returns everything pending when there are fewer. The version above is a direct port of that logic into n8n's Code node shape, not a rewrite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Look up each profile through Unipile
&lt;/h2&gt;

&lt;p&gt;For each row, add an &lt;strong&gt;HTTP Request&lt;/strong&gt; node: &lt;code&gt;GET https://{your-subdomain}.unipile.com:{port}/api/v1/users/{identifier}?account_id={your_account_id}&lt;/code&gt;, with an &lt;code&gt;X-API-KEY&lt;/code&gt; header carrying your Unipile access token. &lt;code&gt;{identifier}&lt;/code&gt; is the slug from the end of the person's profile URL, not their name, so pull it out first in a small Code node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;extractIdentifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;profileUrl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;profileUrl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/linkedin&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;com&lt;/span&gt;&lt;span class="se"&gt;\/&lt;/span&gt;&lt;span class="sr"&gt;in&lt;/span&gt;&lt;span class="se"&gt;\/([^/&lt;/span&gt;&lt;span class="sr"&gt;?#&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;+&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/i&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ProfileUrl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;identifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;extractIdentifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;identifier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Couldn't parse a LinkedIn slug out of: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;identifier&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I verified &lt;code&gt;extractIdentifier&lt;/code&gt; standalone against a profile URL with a trailing slash, one without, one carrying a tracking query string, and a deliberately malformed non-LinkedIn URL. It pulls the clean slug in the first three cases and returns &lt;code&gt;null&lt;/code&gt; (rather than throwing) on the last, which the wrapper above turns into a clear error instead of a silent bad request.&lt;/p&gt;

&lt;p&gt;The response carries the person's &lt;code&gt;provider_id&lt;/code&gt; (needed for the invite in Step 5) and their &lt;code&gt;headline&lt;/code&gt;, so write both back into the row with a &lt;strong&gt;Google Sheets&lt;/strong&gt; &lt;code&gt;Update Row&lt;/code&gt; node, matching on &lt;code&gt;ProfileUrl&lt;/code&gt;, before moving on.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; LinkedIn's official API won't tell you someone's headline without a partnership agreement most of us will never qualify for. Unipile gets it by pretending to be the app on your phone. Welcome to the actual API landscape.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 4: Draft the personalized note
&lt;/h2&gt;

&lt;p&gt;Add a &lt;strong&gt;Basic LLM Chain&lt;/strong&gt; node connected to your Chat Model, with a prompt built from the headline you just pulled, something like: &lt;code&gt;Write a one-sentence, specific LinkedIn connection note (no greeting, no sign-off) referencing this person's role: {{ $json.Headline }}. Keep it under 250 characters.&lt;/code&gt; Asking the model to stay under budget helps, but it isn't reliable enough to skip the hard limit below.&lt;/p&gt;

&lt;p&gt;LinkedIn caps a connection note at 300 characters, counting spaces, so the next Code node enforces that regardless of what the model actually returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fitNote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;note&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;maxLen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;trimmed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;maxLen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;trimmed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cut&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;trimmed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;maxLen&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lastSpace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lastIndexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;safe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;lastSpace&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;maxLen&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;cut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lastSpace&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;cut&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;safe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;.,;:&lt;/span&gt;&lt;span class="se"&gt;\-\s]&lt;/span&gt;&lt;span class="sr"&gt;+$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;fitNote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran this against a short note (left untouched), and a deliberately long one built to clear 300 characters. The trimmed result stayed under the limit, matched a clean prefix of the original text, and never cut mid-word or left a dangling comma or dash at the end. Same logic, same port into the Code node, as the two steps above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Send the invite
&lt;/h2&gt;

&lt;p&gt;Another &lt;strong&gt;HTTP Request&lt;/strong&gt; node, &lt;code&gt;POST https://{your-subdomain}.unipile.com:{port}/api/v1/users/invite&lt;/code&gt;, &lt;code&gt;X-API-KEY&lt;/code&gt; header as before, JSON body built like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;YOUR_ACCOUNT_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{your_account_id}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// from Step 1's hosted auth callback&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildInviteBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;providerId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;note&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;account_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;provider_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;providerId&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;note&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;note&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;buildInviteBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;YOUR_ACCOUNT_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ProviderId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verified standalone too: an empty note correctly omits the &lt;code&gt;message&lt;/code&gt; field entirely (Unipile treats a present-but-empty field differently from an absent one, per its docs), and a real note comes through intact in the body.&lt;/p&gt;

&lt;p&gt;On the HTTP Request node itself, turn on &lt;strong&gt;Retry On Fail&lt;/strong&gt; with a couple of retries for transient 500s, but set &lt;strong&gt;On Error&lt;/strong&gt; to &lt;strong&gt;Continue (using error output)&lt;/strong&gt; rather than stopping the whole batch, since a single bad &lt;code&gt;provider_id&lt;/code&gt; shouldn't block the other nineteen invites in today's run. LinkedIn (via Unipile) returns &lt;code&gt;422 cannot_resend_yet&lt;/code&gt; if you've already invited that person recently, which you want to catch and just mark &lt;code&gt;Skipped&lt;/code&gt; rather than treat as a real failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Record the invite
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Google Sheets&lt;/strong&gt; &lt;code&gt;Update Row&lt;/code&gt;, matching on &lt;code&gt;ProfileUrl&lt;/code&gt; again: set &lt;code&gt;Status&lt;/code&gt; to &lt;code&gt;Invited&lt;/code&gt; and &lt;code&gt;InvitedDate&lt;/code&gt; to today. This is what Step 2's filter checks next run, so skipping it means re-inviting the same people tomorrow, and re-invites are exactly what trips the &lt;code&gt;cannot_resend_yet&lt;/code&gt; error above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Catch acceptances with a second workflow
&lt;/h2&gt;

&lt;p&gt;Sending the invite is the easy half; knowing who said yes is the part a naive version skips entirely. Unipile fires a &lt;code&gt;new_relation&lt;/code&gt; webhook event when a pending invitation turns into an actual connection, so create a "USERS WEBHOOK" subscription for that event pointed at a new n8n &lt;strong&gt;Webhook&lt;/strong&gt; node's URL, then follow it with a Code node that matches the payload back to your sheet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;matchAcceptedInvite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;webhookPayload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;providerId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;webhookPayload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user_provider_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;providerId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ProviderId&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;providerId&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Invited&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;rowNumber&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rowNumber&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;update&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Connected&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;ConnectedDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tested this against a matching &lt;code&gt;Invited&lt;/code&gt; row (returns the right update), a &lt;code&gt;user_provider_id&lt;/code&gt; that isn't in the sheet at all (someone you never invited through this workflow accepting a connection some other way), which correctly returns nothing instead of erroring, a row already marked &lt;code&gt;Connected&lt;/code&gt; (so a duplicate webhook delivery doesn't double-process it), and a malformed payload missing &lt;code&gt;user_provider_id&lt;/code&gt; entirely, which also returns nothing rather than throwing. Feed the sheet rows in via a &lt;strong&gt;Google Sheets&lt;/strong&gt; &lt;code&gt;Get Row(s)&lt;/code&gt; node ahead of this Code node, and when it returns a match, follow with &lt;code&gt;Update Row&lt;/code&gt; to actually write the status change.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; The new_relation event can show up up to 8 hours after someone actually accepts. Unipile polls LinkedIn's relation list at random intervals instead of real time, specifically so the checking itself doesn't look automated. An automation that pretends not to be one, to avoid detection as one. It's layers all the way down.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Pace your LinkedIn outreach automation like a human
&lt;/h2&gt;

&lt;p&gt;Unipile enforces no sending limit of its own, so nothing stops you from blowing past a safe pace except the cap you set yourself. Whatever ceiling you hit is LinkedIn's, reached through Unipile's API instead of the LinkedIn UI. For an established, paid LinkedIn account, a sustainable pace is roughly 80-100 invitations a day and around 200 a week. For a new or quiet profile, start at 10-20 a day and ramp up over two to three weeks rather than jumping straight to that ceiling, which is exactly what the &lt;code&gt;DAILY_CAP&lt;/code&gt; constant in Step 2 is there to enforce. Go over it and you'll see &lt;code&gt;422 cannot_resend_yet&lt;/code&gt; on repeat targets and &lt;code&gt;429&lt;/code&gt;/&lt;code&gt;500&lt;/code&gt; responses on fresh ones; neither is a bug to route around, both are LinkedIn telling you to slow down.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't solve
&lt;/h2&gt;

&lt;p&gt;This covers the connection-request half of outreach, not what happens after someone accepts. That's a real conversation, not another automated message, and this workflow deliberately stops at &lt;code&gt;Connected&lt;/code&gt;. It also doesn't cover InMail or Sales Navigator's advanced search, which sit behind different parts of Unipile's API than what's used here. And none of the pacing advice above is a guarantee: it reflects what's worked as of this writing, not a promise that LinkedIn's detection won't tighten later. If you're tempted to scale past the weekly ceiling by rotating multiple LinkedIn accounts through the same workflow, don't. That pattern is closer to what detection systems are actually built to catch than the pacing itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Build Steps 1 through 3 first and let them run against a handful of rows without ever hitting Step 5, confirming the profile lookups and sheet writes are landing correctly before anything gets sent. Then trigger Steps 4 and 5 manually against one or two contacts you're fine reaching out to personally, and read the actual note it generated before trusting the model's judgment at scale. Only turn on the daily schedule once that's solid, and start it at the low end of the pacing range above, not the high end.&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n Instance MCP Now Lets Claude Drive</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 02 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8n-instance-mcp-now-lets-claude-drive-1gbo</link>
      <guid>https://dev.to/thesolutionscraft/n8n-instance-mcp-now-lets-claude-drive-1gbo</guid>
      <description>&lt;p&gt;Two earlier posts on this site covered MCP one workflow at a time. The &lt;a href="https://solutionscraft.com/automation/enable-n8n-mcp-server-plain-english-workflow" rel="noopener noreferrer"&gt;MCP Server Trigger&lt;/a&gt; exposes a single workflow as a tool, and the &lt;a href="https://solutionscraft.com/automation/connect-external-mcp-server-n8n-ai-agent" rel="noopener noreferrer"&gt;MCP Client Tool&lt;/a&gt; lets an n8n Agent call an external server. Both work fine, but they share the same limit: every new workflow you want an AI assistant to reach means wiring up another trigger, another credential, and another URL to hand out. n8n's &lt;strong&gt;instance-level MCP&lt;/strong&gt; skips all of that. Connect once, with OAuth, and Claude gets a single door into your whole n8n instance instead of a separate one per workflow.&lt;/p&gt;

&lt;p&gt;That's a bigger grant than a single-workflow tool, so this post covers both how to turn it on and how to keep it scoped to what you actually want an assistant touching.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need an n8n instance on a version that supports instance-level MCP. It's been available since 2.18.4 on self-hosted Community Edition (and on Cloud and Enterprise from around the same time), with OAuth added as the recommended connection method in 2.31.0. If you're on an older self-hosted version, update first. If you don't have an instance at all yet, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; gets you one on a current release, instance-level MCP included. You'll also need instance owner or admin permissions (a regular member can't enable this) and Claude Desktop installed on your machine.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link — if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 1: Turn on instance-level MCP
&lt;/h2&gt;

&lt;p&gt;Go to &lt;strong&gt;Settings &amp;gt; Instance-level MCP&lt;/strong&gt; and select &lt;strong&gt;Enable MCP access&lt;/strong&gt;. On a self-hosted instance you can do the same thing at deploy time instead, by setting the environment variable &lt;code&gt;N8N_MCP_ACCESS_ENABLED=true&lt;/code&gt; (available from 2.20.0). That's the better option if you provision instances by config rather than clicking through the UI after every deploy.&lt;/p&gt;

&lt;p&gt;Nothing is exposed yet at this point. Enabling the feature just makes the MCP server exist, it doesn't hand any workflow to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Decide which workflows Claude can see
&lt;/h2&gt;

&lt;p&gt;Open any workflow, click its main &lt;strong&gt;...&lt;/strong&gt; menu in the top-right corner, choose &lt;strong&gt;Settings&lt;/strong&gt;, and flip on &lt;strong&gt;Available in MCP&lt;/strong&gt;. That single workflow now shows up as something an MCP client can find and act on. You can do the same from the workflows list: open a workflow card's menu and pick &lt;strong&gt;Enable MCP access&lt;/strong&gt;, or select several workflows at once and use the &lt;strong&gt;Enable workflows&lt;/strong&gt; button in the table header to expose a whole project or folder at once.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; There's also an "Auto-expose new workflows" toggle back in Settings, which quietly hands Claude every workflow you build from now on. Convenient. Also exactly the kind of setting worth remembering you turned on.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you'd rather opt in per workflow than trust your future self to remember an auto-expose toggle, leave that setting off and come back to Step 2 each time you build something you want the assistant to reach.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Generate the connection details
&lt;/h2&gt;

&lt;p&gt;Back in &lt;strong&gt;Settings &amp;gt; Instance-level MCP&lt;/strong&gt;, open &lt;strong&gt;Connection details&lt;/strong&gt; and select &lt;strong&gt;Connect&lt;/strong&gt;. This opens the &lt;strong&gt;Connect a client&lt;/strong&gt; dialog. Confirm you're on the &lt;strong&gt;OAuth (recommended)&lt;/strong&gt; tab. The alternative &lt;strong&gt;Access Token&lt;/strong&gt; tab issues one long-lived bearer token instead, which works but can't be revoked per client the way an OAuth connection can, so a leaked token means rotating access for everyone who uses it, not just the one client that leaked it.&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;Your client&lt;/strong&gt; dropdown, choose &lt;strong&gt;Claude Desktop&lt;/strong&gt;. n8n shows you a &lt;strong&gt;Server URL&lt;/strong&gt; value tailored to that client. This is the address Claude Desktop authenticates against, not something you construct by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add n8n as a custom connector in Claude Desktop
&lt;/h2&gt;

&lt;p&gt;In Claude Desktop, open &lt;strong&gt;Settings &amp;gt; Connectors&lt;/strong&gt; and select &lt;strong&gt;Add custom connector&lt;/strong&gt;. Give it a name ("n8n MCP" is fine) and paste the Server URL from Step 3 in as the &lt;strong&gt;Remote MCP Server URL&lt;/strong&gt;. Save it, and Claude Desktop prompts you to authorize access to your n8n instance. Approve it, and the OAuth handshake completes without you ever touching a token or a config file by hand.&lt;/p&gt;

&lt;p&gt;This is where instance-level MCP earns its keep over the single-workflow trigger from the earlier post. There, you were editing &lt;code&gt;claude_desktop_config.json&lt;/code&gt; directly and copying a bearer token into an environment variable. Here, the whole connection is a name, a URL, and one authorization click.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; if Claude Desktop connects but can't see any workflows, the fix is almost always Step 2, not the connection itself. Instance-level MCP access and per-workflow "Available in MCP" are two separate switches, and it's easy to flip the first without the second.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 5: Try it from a plain-English prompt
&lt;/h2&gt;

&lt;p&gt;Open a new chat in Claude Desktop and ask for something that maps to a workflow you exposed in Step 2. "What workflows do I have that touch Stripe" is a reasonable first test, since it only needs read access. If the connection is set up right, Claude lists and inspects your workflows without you naming a specific tool.&lt;/p&gt;

&lt;p&gt;From n8n 2.13.0 onward, MCP clients can also build and edit workflows, not just run existing ones, so a prompt like "create a workflow that watches a folder and archives new files" can result in Claude actually assembling nodes in your instance. Check what it produces before you activate it, the same way you'd review a pull request from a new teammate rather than merging it on trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Review and scope what you granted
&lt;/h2&gt;

&lt;p&gt;Each client that connects only gets the permissions it asked for and you approved during that OAuth handshake. Reading workflows without being able to create or run them is a valid, narrower grant than full read, build, and execute access, and it's worth choosing deliberately rather than accepting whatever the default happens to be.&lt;/p&gt;

&lt;p&gt;To see what's actually connected, go back to &lt;strong&gt;Settings &amp;gt; Instance-level MCP&lt;/strong&gt;, open &lt;strong&gt;Connected clients&lt;/strong&gt;, and select &lt;strong&gt;View all&lt;/strong&gt;. You get a table of every OAuth client, its access level, and when it connected, plus a revoke action for anything that shouldn't have access anymore. Get in the habit of checking this table the way you'd check any other service with standing access to your systems, not just once at setup, the same instinct worth applying to &lt;a href="https://solutionscraft.com/automation/audit-n8n-leaked-api-tokens" rel="noopener noreferrer"&gt;auditing an instance for leaked API tokens&lt;/a&gt;: a one-time check is worth less than a habit.&lt;/p&gt;

&lt;p&gt;If you're running self-hosted behind a dedicated hostname (say, &lt;code&gt;n8n-mcp.example.com&lt;/code&gt; in front of the same instance, rather than your normal editor URL), set &lt;code&gt;N8N_MCP_BASE_URL&lt;/code&gt; to that address (available from 2.31.0). n8n advertises that URL during OAuth instead of the instance's default base URL, so clients authenticate against the address you actually intend them to hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you hand over the keys
&lt;/h2&gt;

&lt;p&gt;Instance-level MCP is the right tool when you want an assistant working across your automations generally: "find the workflow that does X" or "build me something new," rather than being scoped to one job. That's also exactly why it deserves more caution than the single-workflow MCP Server Trigger from the earlier post. A client with build and edit access here can, in principle, touch anything you exposed to it, not just answer questions about it, and a workflow it builds for you is one you're choosing to trust before you activate.&lt;/p&gt;

&lt;p&gt;Start narrow. Expose the handful of workflows you actually want an assistant reasoning about, leave "Auto-expose new workflows" off until you trust the habit of reviewing what gets shared, and check the Connected clients table every so often. Once that scope feels right, instance-level MCP is the version of "ask n8n to do something in plain English" that scales past a single workflow, which is the whole point of connecting it this way in the first place.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Turn Instagram Comments Into DMs With n8n</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 02 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/turn-instagram-comments-into-dms-with-n8n-41ne</link>
      <guid>https://dev.to/thesolutionscraft/turn-instagram-comments-into-dms-with-n8n-41ne</guid>
      <description>&lt;p&gt;"Comment LINK and I'll send it to you!" works great for engagement, right up until you're the one copy-pasting the same DM forty times an hour, and inevitably missing a few in the scroll. Instagram comment-to-DM automation fixes exactly this: a keyword in a comment triggers a workflow that replies publicly and privately messages the commenter, in the seconds after they post, every time, with nobody at the keyboard.&lt;/p&gt;

&lt;p&gt;This walkthrough builds the whole thing on n8n and Meta's own Graph API, no third-party automation SaaS in the middle. It's more setup than a no-code app promises, but it's also the same API those apps are calling behind the scenes, so you're not trading capability for control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need an n8n instance (a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; works fine for this, and if this is your first time wiring up an n8n webhook from scratch, &lt;a href="https://solutionscraft.com/automation/first-n8n-workflow" rel="noopener noreferrer"&gt;the folder-watcher walkthrough&lt;/a&gt; covers the editor basics this one builds on) and an Instagram Professional (Business or Creator) account. You'll also need a Meta Developer App with the Instagram product added, so create one at &lt;a href="https://developers.facebook.com/" rel="noopener noreferrer"&gt;developers.facebook.com&lt;/a&gt; if you don't have one yet.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link — if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;One thing worth knowing before you sink an evening into this: sending the private DM needs the &lt;code&gt;instagram_manage_messages&lt;/code&gt; permission, and Meta classes it as a sensitive scope. In development mode it works fine against your own account and any test users you've added, but taking it live for real commenters means submitting the app for App Review first, and reviews for messaging permissions routinely take longer than the more common scopes. Budget for that lag before you promise this to anyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Wire up the comment-to-DM automation webhook
&lt;/h2&gt;

&lt;p&gt;In your Meta app, open &lt;strong&gt;Webhooks&lt;/strong&gt;, choose the &lt;strong&gt;Instagram&lt;/strong&gt; product, and subscribe to the &lt;code&gt;comments&lt;/code&gt; field. It'll ask for a callback URL and a verify token, both of which point at an n8n &lt;strong&gt;Webhook&lt;/strong&gt; node you create for this, so turn on "Allow Multiple HTTP Methods" on that node so it accepts both the one-time verification &lt;code&gt;GET&lt;/code&gt; and the real &lt;code&gt;POST&lt;/code&gt; events afterward.&lt;/p&gt;

&lt;p&gt;Meta's verification handshake is simple but exacting: it sends a &lt;code&gt;GET&lt;/code&gt; with &lt;code&gt;hub.mode&lt;/code&gt;, &lt;code&gt;hub.verify_token&lt;/code&gt;, and &lt;code&gt;hub.challenge&lt;/code&gt; query params, and expects the raw &lt;code&gt;hub.challenge&lt;/code&gt; value echoed back as plain text if your token matches, not JSON, not wrapped in anything else. Branch on the HTTP method with an &lt;code&gt;IF&lt;/code&gt; node, and on the &lt;code&gt;GET&lt;/code&gt; branch use a &lt;strong&gt;Respond to Webhook&lt;/strong&gt; node set to "Text" with the response body &lt;code&gt;{{ $json.query["hub.challenge"] }}&lt;/code&gt;, guarded by a check that &lt;code&gt;$json.query["hub.verify_token"]&lt;/code&gt; matches the token you set in the Meta dashboard.&lt;/p&gt;

&lt;p&gt;I don't have a live Meta app to fire a real request at in this environment, so I tested that matching logic standalone against the exact shape Meta's docs describe, rather than n8n's actual node internals:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleVerification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;expectedVerifyToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hub.mode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;subscribe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hub.verify_token&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;expectedVerifyToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hub.challenge&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Verification failed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// handleVerification({ "hub.mode": "subscribe", "hub.verify_token": "my-secret", "hub.challenge": "12345" }, "my-secret")&lt;/span&gt;
&lt;span class="c1"&gt;// -&amp;gt; { status: 200, body: "12345" }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ran that in plain Node against a matching token and a deliberately wrong one, and it echoes the challenge only when the token lines up, 403s otherwise, which is exactly the contract Meta's docs describe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Filter for your trigger keyword
&lt;/h2&gt;

&lt;p&gt;Every comment on every post you own fires this webhook, so the next node's job is to throw out everything that isn't the keyword you care about, and to ignore the echo of your own reply so the workflow doesn't loop on itself. Add a &lt;strong&gt;Code&lt;/strong&gt; node on the &lt;code&gt;POST&lt;/code&gt; branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;?.[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;change&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;changes&lt;/span&gt;&lt;span class="p"&gt;?.[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;change&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;change&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;field&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;comments&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;change&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;OWN_IG_USER_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;your IG user id&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;OWN_IG_USER_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;KEYWORDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;link&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;guide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;matched&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;KEYWORDS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;matched&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;
  &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;commentId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;commenterId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;commenterUsername&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; Somewhere a spec writer decided a webhook that fires on your own reply, right after you reply, was a feature and not a trap. Check the sender id, always.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I verified this filtering logic (case-insensitive keyword match, and skipping the account's own comments) as a standalone script against a sample payload shaped like Meta's documented &lt;code&gt;comments&lt;/code&gt; webhook, and a match returns the parsed fields while a non-match and a self-authored comment both correctly return nothing. Wiring the exact same logic into an n8n Code node is a direct port, not a rewrite, but the live n8n execution itself isn't something I ran here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Reply publicly first
&lt;/h2&gt;

&lt;p&gt;A public reply keeps the conversation visible under the post, a bit of social proof for the next person scrolling by, and it's the same endpoint whether or not you go on to DM anyone. Add an &lt;strong&gt;HTTP Request&lt;/strong&gt; node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST https://graph.instagram.com/v21.0/{{ $json.commentId }}/replies
Authorization: Bearer &amp;lt;your Instagram access token&amp;gt;
Content-Type: application/json

{ "message": "Sent you a DM with the link! 📩" }
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Send the private DM
&lt;/h2&gt;

&lt;p&gt;This is the actual comment-to-DM automation piece, turning that public comment into a private message without the commenter ever having messaged you first. Instagram's Messaging API supports exactly one flow for this: a &lt;strong&gt;private reply&lt;/strong&gt;, sent from your own IG account's &lt;code&gt;/messages&lt;/code&gt; endpoint but addressed by comment ID rather than by the commenter's user ID, in another HTTP Request node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST https://graph.instagram.com/v21.0/{{ $json.myIgUserId }}/messages
Authorization: Bearer &amp;lt;your Instagram access token&amp;gt;
Content-Type: application/json

{
  "recipient": { "comment_id": "{{ $json.commentId }}" },
  "message": { "text": "Here's the link: https://solutionscraft.com/newsletter" }
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;{{ $json.myIgUserId }}&lt;/code&gt; here is your own Instagram business account's user ID (the same value you'd hardcode as &lt;code&gt;OWN_IG_USER_ID&lt;/code&gt; in Step 2), not the commenter's, since the endpoint is scoped to your account and the recipient is identified through the &lt;code&gt;comment_id&lt;/code&gt; in the body instead.&lt;/p&gt;

&lt;p&gt;Two hard limits worth planning around, straight from Meta's docs: you can only private-reply to a comment within 7 days of it being posted, and you only get &lt;strong&gt;one&lt;/strong&gt; private reply per comment, ever. Send it once and that comment's window is closed for good, so this isn't a node you want firing twice on a retry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Land the DM link on a page, not an API call
&lt;/h2&gt;

&lt;p&gt;It's tempting to have the DM link straight into your own signup API to skip a step, but don't point it at an endpoint sitting behind bot protection. Ours, like most newsletter signup forms, is gated by Cloudflare Turnstile, which needs an actual browser solving a challenge, something no link click can do on its own. Send the DM to your normal newsletter signup page instead, and let the page's existing form (Turnstile check, Resend contact creation, automatic welcome email) do the rest exactly the way a human visitor triggers it. The automation's job ends at getting a warm click into that page, not at replacing the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't solve
&lt;/h2&gt;

&lt;p&gt;This catches new comments going forward, not a backlog of ones posted before the webhook was live, and it won't touch anything if you edit an existing comment. Instagram also caps API calls at 200 per user per hour (down from the 5,000 you'll see quoted in older tutorials), so a viral post with the keyword in a huge share of the comments can outrun this well before it outruns your patience. And the 7-day/one-reply limits from Step 4 mean this is a first-touch tool, so anything past the initial DM needs a real conversation, not another automated message.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Wire up Steps 1 and 2 first and just watch the executions log for a day against your own comments, confirming the keyword filter catches the right ones and ignores your own replies before you let Step 4 actually message a stranger. Once that's solid, turn on the public reply and private DM, and treat App Review for &lt;code&gt;instagram_manage_messages&lt;/code&gt; as the thing to submit in parallel, not after, since it's the step most likely to make you wait. If you'd rather point n8n itself at an AI assistant once this is running, &lt;a href="https://solutionscraft.com/automation/connect-claude-desktop-n8n-instance-mcp-oauth" rel="noopener noreferrer"&gt;connecting n8n's instance-level MCP to Claude Desktop&lt;/a&gt; covers asking it to inspect or adjust a workflow like this one in plain English.&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>n8n's Expression Engine Just Got Stricter</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 25 Sep 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/n8ns-expression-engine-just-got-stricter-110l</link>
      <guid>https://dev.to/thesolutionscraft/n8ns-expression-engine-just-got-stricter-110l</guid>
      <description>&lt;p&gt;You upgrade n8n, nothing in the changelog looks scary, and a week later a workflow that's run quietly for months starts throwing errors on an expression you haven't touched. Nobody edited it. The data feeding it didn't change shape. The only thing that moved is n8n itself, and buried in the 2.35.0 release notes is the line that explains it: n8n made its &lt;strong&gt;VM expression engine&lt;/strong&gt; the default, replacing the older &lt;strong&gt;Tournament&lt;/strong&gt; engine that had run every &lt;code&gt;{{ }}&lt;/code&gt; expression since the beginning.&lt;/p&gt;

&lt;p&gt;This one's worth taking seriously for a reason the &lt;a href="https://solutionscraft.com/automation/migrate-n8n-notion-workflow-v3-data-source" rel="noopener noreferrer"&gt;Notion v3 migration&lt;/a&gt; wasn't: node versions are pinned per-workflow, so upgrading n8n doesn't silently change how an existing Notion node behaves. The expression engine isn't like that. It's set with an environment variable at the instance level, and it applies to every workflow's next execution the moment you're running 2.35.0 or later, whether or not you asked for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need shell or dashboard access to your n8n instance (to check its version and, if needed, set an environment variable) and edit access to the workflows you want to audit. This applies to self-hosted n8n; if you're on n8n Cloud, more on that at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Confirm you're actually on the new engine
&lt;/h2&gt;

&lt;p&gt;Check your instance version first (Settings → About in the UI, or &lt;code&gt;n8n --version&lt;/code&gt; from the CLI). Anything 2.35.0 or later is running the VM engine by default unless someone already set &lt;code&gt;N8N_EXPRESSION_ENGINE=legacy&lt;/code&gt;. If you're below 2.35.0, this doesn't apply yet, but it will the moment you upgrade, so it's worth reading before you do rather than after something breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Understand what actually changed
&lt;/h2&gt;

&lt;p&gt;Tournament and the new VM engine both run your expression as JavaScript, so the language itself hasn't changed. What changed is how errors during evaluation get handled. Tournament wraps every expression in a try/catch and, depending on the error type, would often swallow a failure quietly and resolve to &lt;code&gt;undefined&lt;/code&gt; rather than stop the workflow. The VM engine runs expressions inside an actual isolated V8 context (via &lt;code&gt;isolated-vm&lt;/code&gt;) with a hard memory limit (128MB by default) and execution timeout (5 seconds by default), and it's meaningfully stricter about which errors it lets pass silently versus which ones it re-throws.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt; A workflow that silently resolves to undefined and limps forward is a workflow with a bug you haven't found yet. I'd rather it just told me.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Blip's not wrong, but "stricter" still means workflows built around the old quiet-failure behavior are the ones at risk now. The pattern to look for is any expression that chains into a property that might not exist on every item, something that used to quietly become &lt;code&gt;undefined&lt;/code&gt; and now has a real chance of throwing instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Find the risky pattern in your workflows
&lt;/h2&gt;

&lt;p&gt;The expressions most likely to behave differently are direct property chains with no guard, especially several levels deep or reaching into data that isn't guaranteed present on every item:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;$json.customer.address.city&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;customer&lt;/code&gt; or &lt;code&gt;address&lt;/code&gt; is ever missing on an item (a common shape for optional fields from an API, a webhook payload that varies by event type, or an upstream node that doesn't always return the same structure), this is exactly the kind of expression that could tolerate the gap quietly before and won't now. I confirmed the underlying JavaScript behavior directly, since both engines evaluate real JS under the hood:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;city&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Cannot read properties of undefined (reading 'city')&lt;/span&gt;

&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;city&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// undefined, no throw&lt;/span&gt;

&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;city&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Unknown&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// "Unknown"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search your workflows for expressions with two or more chained &lt;code&gt;.&lt;/code&gt; property accesses and no &lt;code&gt;?.&lt;/code&gt; anywhere in the chain. That's your audit list. Pay closest attention to workflows using an Error Trigger, or ones with sub-nodes that reference data from earlier in the flow across an AI Agent connection; paired-item resolution across those boundaries is one of the specific spots the n8n team had to patch for consistency between the two engines, which tells you it's a genuine edge case, not a hypothetical one.&lt;/p&gt;

&lt;p&gt;Opening every workflow by hand to eyeball its expressions doesn't scale past a handful. If you're self-hosted and have CLI access, n8n's &lt;code&gt;export:workflow&lt;/code&gt; command dumps every workflow to JSON in one shot, and from there it's a normal grep problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;n8n &lt;span class="nb"&gt;export&lt;/span&gt;:workflow &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./audit/
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-roE&lt;/span&gt; &lt;span class="s1"&gt;'\{\{[^}]*\.[a-zA-Z_]+\.[a-zA-Z_]+[^}]*\}\}'&lt;/span&gt; ./audit/ | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s1"&gt;'?\.'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tested this exact pattern against a sample workflow JSON with one guarded and one unguarded expression, and it correctly pulled only the unguarded one. It's a starting list, not a verdict (some flagged expressions will turn out fine once you check whether that particular field can actually be missing), but it turns "audit the instance" into "review a short list" instead of "click through every workflow."&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Fix what you find
&lt;/h2&gt;

&lt;p&gt;For each risky expression, add optional chaining and a sensible fallback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;$json.customer.address?.city&lt;span class="w"&gt; &lt;/span&gt;??&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Unknown"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a one-character-per-link change (&lt;code&gt;?.&lt;/code&gt; instead of &lt;code&gt;.&lt;/code&gt;) plus a &lt;code&gt;??&lt;/code&gt; default at the end, and it makes the expression behave the same way under either engine: no silent &lt;code&gt;undefined&lt;/code&gt;, no thrown error, just the fallback value you chose. If an expression is doing something more involved than a property chain (a multi-step transform, several fallbacks chained together), it's usually clearer, and easier to test, moved into a Code node instead, where you can wrap it in an actual &lt;code&gt;try&lt;/code&gt;/&lt;code&gt;catch&lt;/code&gt; and decide exactly what happens on failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Use the rollback as a stopgap, not a fix
&lt;/h2&gt;

&lt;p&gt;If you've just upgraded and don't have time to audit before your workflows run again, you can buy yourself room with an environment variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;N8N_EXPRESSION_ENGINE=legacy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This restores Tournament's behavior instance-wide, immediately. Treat it as a pause button, not a destination. The VM engine is where n8n is investing going forward (it's also faster on repeated expressions thanks to code caching, and the isolation is a real security improvement), so the goal is auditing your way back to the default, not living on &lt;code&gt;legacy&lt;/code&gt; indefinitely.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Set the variable, restart, confirm your previously-broken workflow runs clean again, then work through Step 3's audit list on your own schedule instead of your production traffic's.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;If you've already upgraded and something's actively failing, set &lt;code&gt;N8N_EXPRESSION_ENGINE=legacy&lt;/code&gt; first to stop the bleeding, then work through Step 3's search for unguarded property chains before removing the rollback. If you haven't upgraded yet, do the audit now, while it's a code review instead of an incident. Either way, the fix is the same one-line change repeated as many times as your audit turns up. It's the same audit-before-it-bites-you shape as &lt;a href="https://solutionscraft.com/automation/audit-n8n-leaked-api-tokens" rel="noopener noreferrer"&gt;checking your instance for leaked n8n API tokens&lt;/a&gt;, just for an expression engine instead of a credential.&lt;/p&gt;

&lt;p&gt;If you're on n8n Cloud, this engine switch already happened for you as part of a coordinated rollout n8n tested ahead of time. You don't control when it lands, but you also don't have to schedule the audit around your own upgrade timing. If owning that timing yourself isn't something you want to keep doing release after release, a free &lt;a href="https://n8n.partnerlinks.io/4rue2byfzbu6" rel="noopener noreferrer"&gt;n8n Cloud trial&lt;/a&gt; is worth a look.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; the n8n Cloud link above is an affiliate link — if you sign up through it, we may earn a commission at no extra cost to you. See our &lt;a href="https://solutionscraft.com/disclosure" rel="noopener noreferrer"&gt;affiliate disclosure&lt;/a&gt; for details.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Is Your n8n API Key Already Leaked?</title>
      <dc:creator>SolutionsCraft</dc:creator>
      <pubDate>Fri, 18 Sep 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/thesolutionscraft/is-your-n8n-api-key-already-leaked-321n</link>
      <guid>https://dev.to/thesolutionscraft/is-your-n8n-api-key-already-leaked-321n</guid>
      <description>&lt;p&gt;You copy an n8n API key into a &lt;code&gt;.env&lt;/code&gt; file to test something quick, commit the whole folder because you're in a hurry, notice a minute later, and delete the file in the next commit. Problem solved, right? Except git doesn't forget. The key is still sitting in that first commit, reachable by anyone who can run &lt;code&gt;git log -p&lt;/code&gt; against your history, whether or not it's still in the file today.&lt;/p&gt;

&lt;p&gt;That's not a hypothetical. GitGuardian &lt;a href="https://thehackernews.com/2026/08/leaked-n8n-api-tokens-exposed-live.html" rel="noopener noreferrer"&gt;scanned public GitHub commits&lt;/a&gt; in early August 2026 and found 4,576 distinct n8n API tokens sitting out in the open, tied to 1,255 different hostnames. Of the 896 instances they could actually reach, 321 accepted at least one of the leaked tokens, no exploit required, no password guessing, just an unrotated token from an old commit. A valid token hands over workflows, execution history, stored data tables, and enough about your credentials to know exactly what to go after next.&lt;/p&gt;

&lt;p&gt;This walkthrough covers two things: a script that actually finds n8n keys in your git history (not just anything that looks vaguely like a secret), and what to do once you find one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Blip:&lt;/strong&gt;"I deleted the file" and "I removed the secret" are not the same sentence. Git remembers the first draft even after you've moved on from it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need shell access to a local clone of any repo you want to check, and access to your n8n instance's &lt;strong&gt;Settings &amp;gt; n8n API&lt;/strong&gt; page for the rotation step later. No n8n instance changes happen until Step 3, so it's safe to run the scan against a repo without touching anything live yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Know what you're looking for
&lt;/h2&gt;

&lt;p&gt;n8n's public API keys are JWTs, they start with &lt;code&gt;eyJ&lt;/code&gt;, the standard base64 prefix for JSON, followed by two more base64 segments separated by dots. That shape isn't unique to n8n, plenty of other services hand out JWTs too, so a naive "does this look like a token" grep gets noisy fast. What &lt;em&gt;is&lt;/em&gt; specific to n8n is what's inside the payload: n8n signs its API keys with &lt;code&gt;"iss": "n8n"&lt;/code&gt; and &lt;code&gt;"aud": "public-api"&lt;/code&gt; claims. Decode the middle segment of any JWT and you can tell immediately whether it's one of these keys or something else entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Scan your git history
&lt;/h2&gt;

&lt;p&gt;This is the part worth actually running, not just reading. It walks every commit (&lt;code&gt;git log -p --all&lt;/code&gt;), pulls out anything shaped like a JWT, decodes each candidate's payload, and only flags the ones whose &lt;code&gt;iss&lt;/code&gt;/&lt;code&gt;aud&lt;/code&gt; claims match n8n's:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="c"&gt;# Scans the full git history (not just the working tree) of the current repo&lt;/span&gt;
&lt;span class="c"&gt;# for n8n public API keys. n8n API keys are JWTs, so a plain "looks like a&lt;/span&gt;
&lt;span class="c"&gt;# JWT" grep also catches unrelated tokens; this decodes each candidate's&lt;/span&gt;
&lt;span class="c"&gt;# payload and only flags the ones whose issuer/audience claims match n8n's.&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="nv"&gt;candidates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git log &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; 2&amp;gt;/dev/null &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-oE&lt;/span&gt; &lt;span class="s1"&gt;'eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-z&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$candidates&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"No JWT-shaped strings found in git history."&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nv"&gt;found&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; token&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;&lt;span class="nv"&gt;payload_b64&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$token&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-f2&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="nv"&gt;padded&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$payload_b64&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="s1"&gt;'_-'&lt;/span&gt; &lt;span class="s1"&gt;'/+'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;$((&lt;/span&gt; &lt;span class="k"&gt;${#&lt;/span&gt;&lt;span class="nv"&gt;padded&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt; &lt;span class="k"&gt;))&lt;/span&gt; &lt;span class="k"&gt;in
    &lt;/span&gt;2&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;padded&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;padded&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;=="&lt;/span&gt; &lt;span class="p"&gt;;;&lt;/span&gt;
    3&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;padded&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;padded&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;="&lt;/span&gt; &lt;span class="p"&gt;;;&lt;/span&gt;
  &lt;span class="k"&gt;esac&lt;/span&gt;
  &lt;span class="nv"&gt;payload&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$padded&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;base64&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; 2&amp;gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$payload&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="s1"&gt;'"iss": *"n8n"'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$payload&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="s1"&gt;'"aud": *"public-api"'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nv"&gt;found&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt;found &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="k"&gt;))&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"FOUND n8n API key in git history: &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;token&lt;/span&gt;:0:24&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;...&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;token&lt;/span&gt;:&lt;span class="p"&gt; -8&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;" payload: &lt;/span&gt;&lt;span class="nv"&gt;$payload&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;fi
done&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$candidates&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$found&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-eq&lt;/span&gt; 0]&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"No n8n API keys found (JWTs present but none matched n8n's issuer/audience claims)."&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$found&lt;/span&gt;&lt;span class="s2"&gt; n8n API key(s) found in git history. Deleting the file today does NOT remove"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"them, they're still reachable via 'git log -p' or any clone. Rotate every key found"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"here, then scrub history (git filter-repo / BFG) if this repo is or was ever public."&lt;/span&gt;
&lt;span class="nb"&gt;exit &lt;/span&gt;1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save it as &lt;code&gt;scan-n8n-tokens.sh&lt;/code&gt;, &lt;code&gt;chmod +x&lt;/code&gt; it, and run it from inside the repo you want to check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;./scan-n8n-tokens.sh

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tested this against two throwaway repos before writing it into this post. One had an n8n key committed and then "removed" in a later commit, exactly the scenario above, and the script caught it and printed the payload showing &lt;code&gt;iss: n8n, aud: public-api&lt;/code&gt;. The other had a JWT-shaped decoy with a completely different issuer, and the script correctly ignored it, so you won't get paged for every unrelated token your history happens to contain. A clean repo with no JWTs at all reports that plainly and exits 0, so you can drop this into a pre-merge CI check without it crying wolf.&lt;/p&gt;

&lt;p&gt;Run it against every repo that's ever touched an n8n key, including ones you've since made private. GitGuardian's numbers came from &lt;em&gt;public&lt;/em&gt; GitHub commits specifically, but a repo you flipped to private after the fact doesn't retroactively un-leak anything that was already indexed or cloned while it was public.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Rotate anything you find
&lt;/h2&gt;

&lt;p&gt;If the scan turns up a hit, treat that key as burned, full stop, whether or not you can prove anyone actually used it. Rotation itself is a UI action in n8n, not something scriptable through the public API (you'd otherwise need a valid key just to revoke itself, which doesn't help you here):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Settings &amp;gt; n8n API&lt;/strong&gt; on the affected instance.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create an API key&lt;/strong&gt; , give it a label you'll recognize later, and set an &lt;strong&gt;Expiration&lt;/strong&gt; if your plan supports it, an expiring key limits exactly this kind of damage the next time a token slips into a commit.&lt;/li&gt;
&lt;li&gt;Update every place that used the old key, your automation scripts, CI secrets, anywhere it was configured, to the new one.&lt;/li&gt;
&lt;li&gt;Go back to &lt;strong&gt;Settings &amp;gt; n8n API&lt;/strong&gt; , find the old key in the list, and select &lt;strong&gt;Delete&lt;/strong&gt; next to it. It's revoked immediately.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Do this even if the leaked key is months old and "probably fine." GitGuardian's whole point was that these tokens don't expire on their own, an n8n API key created without an expiration date stays valid indefinitely until someone deletes it, so "probably fine" and "still fully valid" are the same thing from the token's perspective.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Get it out of history too, if the repo was ever public
&lt;/h2&gt;

&lt;p&gt;Rotating the key stops it from working, but the string itself is still sitting in your git history, which is untidy and, if this repo is open source or shared, worth cleaning up so the next contributor doesn't find it and wonder if it's still live. &lt;code&gt;git filter-repo&lt;/code&gt; (or the older BFG Repo-Cleaner) can strip a specific string from every commit that ever contained it. This rewrites history, so it needs a force-push and coordination with anyone else who has the repo cloned, which is a bigger operation than this post covers, but it's the right follow-up once the immediate danger (a working, unrevoked key) is handled.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't solve
&lt;/h2&gt;

&lt;p&gt;Scanning your own repo's history only tells you what's true for &lt;em&gt;that&lt;/em&gt; repo. It can't tell you whether someone already cloned it while the key was live, whether it's sitting in a CI log, a Slack message, or a support ticket screenshot, or whether it leaked through a channel that has nothing to do with git at all. Treat "I found it and rotated it" as closing the door you know about, not a guarantee nothing walked through it first.&lt;/p&gt;

&lt;p&gt;It also won't catch a key that's still &lt;em&gt;currently&lt;/em&gt; committed in your working tree, only what's reachable through history. Run a plain &lt;code&gt;git grep&lt;/code&gt; for &lt;code&gt;eyJ&lt;/code&gt; against your current checkout too, and consider adding GitHub's push protection (Settings &amp;gt; Code security &amp;gt; Push protection) on any repo that might touch one of these keys again, it blocks a commit containing a recognizable secret pattern before it ever reaches the remote, which is a much better place to stop this than a post-hoc scan.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;Run the scan today against every repo that has ever had an n8n key anywhere near it, not just the ones you remember. If it comes back clean, good, now you know, and it's a five-minute script you can rerun anytime you're not sure. If it finds something, rotate the key before you do anything else, the five minutes that takes is a lot cheaper than being one of the 321 instances that answered when GitGuardian knocked. It's one item on a short list of n8n instance-hardening checks worth running together, alongside the &lt;a href="https://solutionscraft.com/automation/audit-and-patch-n8n-sandbox-escape-vulnerability" rel="noopener noreferrer"&gt;sandbox-escape vulnerability patch&lt;/a&gt; and the &lt;a href="https://solutionscraft.com/automation/n8n-fromai-sandbox-escape-patch" rel="noopener noreferrer"&gt;$fromAI prototype-leak escape hatch&lt;/a&gt;, both quiet-until-someone-finds-it bugs in the same vein as an unrotated key.&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>security</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
