{
  "name": "Auto-document and backup workflows with GPT-4 and Airtable",
  "nodes": [
    {
      "id": "8261a2c4-7000-4eea-950d-8cbcec82a3c9",
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        -3248,
        16
      ]
    },
    {
      "id": "9ccbe56e-941f-4ad2-9272-54dc8461c4ad",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -7024,
        16
      ]
    },
    {
      "id": "8020a4d9-3600-42ef-b2bb-6f2f3e3490e3",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -3024,
        16
      ]
    },
    {
      "id": "338a4507-94e0-4308-b969-87cf8266bdcb",
      "name": "Search all snapshots",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -6480,
        16
      ]
    },
    {
      "id": "165438d4-3e23-4cf9-9372-d51080fb1969",
      "name": "Re-summarise workflow",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -4272,
        -304
      ]
    },
    {
      "id": "0f83a04c-0979-467d-a4b3-60b8a165e657",
      "name": "Store new workflow summary",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -3920,
        -304
      ]
    },
    {
      "id": "32ad534c-3b4d-4388-894e-630954153bfa",
      "name": "Get full workflow JSON",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -3472,
        16
      ]
    },
    {
      "id": "72df750a-b797-4e6b-b0de-4ecf5d6e894e",
      "name": "Only keep new snapshots",
      "type": "n8n-nodes-base.filter",
      "position": [
        -7248,
        16
      ]
    },
    {
      "id": "5e310efb-1892-4baa-a7c0-ff3c00523f19",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2496,
        384
      ]
    },
    {
      "id": "ebde51ba-5dd3-45c7-87bb-18e5d8770a8a",
      "name": "Get all n8n workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -7696,
        -80
      ]
    },
    {
      "id": "5e6d74f2-67c5-4f89-9532-82245f02530f",
      "name": "Match snapshot IDs",
      "type": "n8n-nodes-base.merge",
      "position": [
        -7472,
        16
      ]
    },
    {
      "id": "e10fab34-aea2-4c08-a1a0-307f1199932c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -8048,
        16
      ]
    },
    {
      "id": "2b9546ed-ba58-48b1-b43d-21572d0fbec8",
      "name": "Search all existing snapshots",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -7696,
        112
      ]
    },
    {
      "id": "5d3175e6-0f5c-4bd3-92a6-93f97ee0aea9",
      "name": "Download previous snapshot",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -5776,
        -320
      ]
    },
    {
      "id": "071d5954-a253-4900-98cb-3ef035855d2a",
      "name": "Extract from File1",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -5552,
        -320
      ]
    },
    {
      "id": "ed9bb794-da8c-42df-b9fd-fa169d178db7",
      "name": "Create or update workflow",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -6720,
        16
      ]
    },
    {
      "id": "9afc3bb4-3923-43de-9695-ea517afb630b",
      "name": "Check workflow status",
      "type": "n8n-nodes-base.code",
      "position": [
        -6256,
        16
      ]
    },
    {
      "id": "74884b3d-dd8f-4e13-919e-709aa3b32fad",
      "name": "Existing workflow?",
      "type": "n8n-nodes-base.if",
      "position": [
        -6032,
        16
      ]
    },
    {
      "id": "8923c1a8-5189-43e1-a599-c51d9652ea24",
      "name": "Prepare edits since last snapshot",
      "type": "n8n-nodes-base.set",
      "position": [
        -4976,
        -320
      ]
    },
    {
      "id": "08e5c6e2-0afe-47bc-82a3-878c809a2b28",
      "name": "State that this is the first version",
      "type": "n8n-nodes-base.set",
      "position": [
        -5008,
        144
      ]
    },
    {
      "id": "2d8d28df-6cab-419a-93d7-b0d3e78253b8",
      "name": "Consolidate edits since last snapshot",
      "type": "n8n-nodes-base.set",
      "position": [
        -4720,
        16
      ]
    },
    {
      "id": "1e3c97c4-6685-4e38-8a6b-ef90894dc77c",
      "name": "Needs new workflow summary?",
      "type": "n8n-nodes-base.if",
      "position": [
        -4496,
        16
      ]
    },
    {
      "id": "fb6cd7e8-8ed4-4b8b-a070-151eb4646bc8",
      "name": "Document workflow differences",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -5328,
        -320
      ]
    },
    {
      "id": "8022caab-0a00-47fd-b25f-659b237ee0dc",
      "name": "Store new snapshot",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -3696,
        16
      ]
    },
    {
      "id": "19a0d146-27a3-4cbd-8249-bf883cb54862",
      "name": "Store workflow file into Airtable",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2768,
        16
      ]
    },
    {
      "id": "f0c35245-4949-41bf-ab9f-1a2b2dccc131",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -4848,
        672
      ]
    },
    {
      "id": "8e5f5a92-9111-4891-beb3-cd3d9fe7e923",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2880,
        -368
      ],
      "parameters": {
        "width": 352,
        "height": 576,
        "content": "## Insert your Airtable base ID into the URL\nThe current URL contains <AIRTABLE-BASE-ID>\nwhich should be replaced by the Airtable base ID. \n\nOpen the Airtable base you've prepared for this workflow an"
      }
    },
    {
      "id": "75fc1067-486e-4718-9893-7baba3402591",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3504,
        -112
      ],
      "parameters": {
        "width": 608,
        "height": 320,
        "content": "## Preparing this workflow version to be imported into Airtable as a file"
      }
    },
    {
      "id": "8daa99f7-f960-4675-9a9e-111aba5eebc1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4352,
        -608
      ],
      "parameters": {
        "width": 608,
        "height": 528,
        "content": "## (re)-summarising the workflow with AI\nIf this is the first, second, third or a multiple of 5 # of snapshot we have for this workflow, we want to let AI re-generate a summary of the workflow as some"
      }
    },
    {
      "id": "ae3cb5a1-56be-4a68-8039-0fa5b943df00",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5824,
        -480
      ],
      "parameters": {
        "width": 992,
        "height": 432,
        "content": "## AI-documenting the edits VS the previous snapshot\nAs we have stored the file of the last snapshot, we might want to store for each new version a summary of the changes compared to the previous one."
      }
    },
    {
      "id": "37ddafe2-30ea-40f1-8db1-346a2e09b750",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6800,
        -32
      ],
      "parameters": {
        "width": 256,
        "height": 416,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nIf the workflow didn't have a record yet in the \"Workflows\" tab in Airtable, this is when it gets created.\nIf it already existed, it resets the name anyway, in case it has changed si"
      }
    },
    {
      "id": "4d94c74f-be8d-41a4-870e-149533e303bc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6336,
        -32
      ],
      "parameters": {
        "width": 256,
        "height": 416,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis code looks at the result of our search of all past snapshots and returns the number of snapshots and Yes or No, whether it is time to re-generate a summary of the workflow or no"
      }
    },
    {
      "id": "4bcc671d-a4d9-4d4f-b616-d7eeed703110",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -7792,
        -224
      ],
      "parameters": {
        "width": 656,
        "height": 544,
        "content": "## Retrieving all workflows that have new snapshots\nBy comparing the list of the most recent version ID for each workflow and the list of snapshots we have stored in Airtable, we are able to detect th"
      }
    },
    {
      "id": "f9d24d5b-e86e-423b-8d2c-8cb9b096f54f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4992,
        624
      ],
      "parameters": {
        "width": 384,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Connect your favorite AI provider and model\nIf you tend to have big workflows, their JSON might be long which will consume many Input tokens. As the quality of these AI insights isn't"
      }
    },
    {
      "id": "58f05bec-ef7d-4e8b-a8bf-a267ff842cd8",
      "name": "The backup is done!",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -6736,
        -272
      ]
    },
    {
      "id": "0de48f62-8638-418d-b7ba-f86746fba33b",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -8160,
        -224
      ],
      "parameters": {
        "width": 320,
        "height": 544,
        "content": "## Define your backup frequency\nDaily, weekly, or hourly backup, you decide! Configure this node and activate the workflow to push it live."
      }
    },
    {
      "id": "c9fd49c3-5976-419c-aa04-42ee0cff5840",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2528,
        256
      ],
      "parameters": {
        "width": 400,
        "height": 288,
        "content": "## Let's give some time to Airtable's API to rest!\nYes, REST APIs need to rest... ;)\n... to not reach rate limits."
      }
    },
    {
      "id": "7a3ea014-330c-47f5-a547-4c5b18b6f1be",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -8720,
        -336
      ],
      "parameters": {
        "width": 512,
        "height": 656,
        "content": "# Automated Workflow Backup & AI Documenter\n\nThis workflow runs on a schedule to find new versions of your workflows. It uses AI to generate a summary and a \"what's new\" changelog, then saves the back"
      }
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "The backup is done!",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create or update workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get all n8n workflows",
            "type": "main",
            "index": 0
          },
          {
            "node": "Search all existing snapshots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Store workflow file into Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Existing workflow?": {
      "main": [
        [
          {
            "node": "Download previous snapshot",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "State that this is the first version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File1": {
      "main": [
        [
          {
            "node": "Document workflow differences",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Match snapshot IDs": {
      "main": [
        [
          {
            "node": "Only keep new snapshots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Document workflow differences",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Re-summarise workflow",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Store new snapshot": {
      "main": [
        [
          {
            "node": "Get full workflow JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search all snapshots": {
      "main": [
        [
          {
            "node": "Check workflow status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check workflow status": {
      "main": [
        [
          {
            "node": "Existing workflow?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all n8n workflows": {
      "main": [
        [
          {
            "node": "Match snapshot IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Re-summarise workflow": {
      "main": [
        [
          {
            "node": "Store new workflow summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get full workflow JSON": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only keep new snapshots": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update workflow": {
      "main": [
        [
          {
            "node": "Search all snapshots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download previous snapshot": {
      "main": [
        [
          {
            "node": "Extract from File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store new workflow summary": {
      "main": [
        [
          {
            "node": "Store new snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs new workflow summary?": {
      "main": [
        [
          {
            "node": "Re-summarise workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Store new snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document workflow differences": {
      "main": [
        [
          {
            "node": "Prepare edits since last snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search all existing snapshots": {
      "main": [
        [
          {
            "node": "Match snapshot IDs",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Prepare edits since last snapshot": {
      "main": [
        [
          {
            "node": "Consolidate edits since last snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store workflow file into Airtable": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "State that this is the first version": {
      "main": [
        [
          {
            "node": "Consolidate edits since last snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Consolidate edits since last snapshot": {
      "main": [
        [
          {
            "node": "Needs new workflow summary?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}