{
  "name": "Sync Google Drive files to an InfraNodus Knowledge Graph",
  "nodes": [
    {
      "id": "b3c9c0dd-7f02-42d0-9fd0-bf25319cf0f0",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -220,
        -100
      ]
    },
    {
      "id": "a41556ba-b7db-41b5-8213-e1aff3f7fe03",
      "name": "Retrieve File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        260,
        -180
      ]
    },
    {
      "id": "bc74f177-7ff6-4c3b-b63a-6f9f2d11a9b8",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        680,
        -20
      ]
    },
    {
      "id": "1844fd33-c4a3-43ef-b945-dcf433f7e424",
      "name": "Extract from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        920,
        -260
      ]
    },
    {
      "id": "6da5e064-8ea3-4c2c-9bc9-5c66deb63b3a",
      "name": "Extract from Text File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        920,
        -60
      ]
    },
    {
      "id": "6b70f1e5-82ca-4109-8047-7b9491fa7619",
      "name": "Extract from Markdown",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        920,
        140
      ]
    },
    {
      "id": "e46d8e8d-72b5-4a57-bb09-6915b4af28e5",
      "name": "InfraNodus Save to Graph",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1580,
        240
      ]
    },
    {
      "id": "cebe84e6-3f9d-4806-b42a-2664717baef1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -360
      ],
      "parameters": {
        "width": 500,
        "height": 520,
        "content": "## 1. Listen to a Google Drive folder / create new file event\n\n### You need to create the folder first and upload the files there. \n\n🚨 Specify the folder you want to use here"
      }
    },
    {
      "id": "cff84fdb-9fd1-4600-a436-d452ec73778d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -360
      ],
      "parameters": {
        "width": 500,
        "height": 520,
        "content": "## 2. Iterate through every file extracted\n\n### We get the ID of the file and iterate through them one by one\n\n\n"
      }
    },
    {
      "id": "e0e1bab5-e281-4572-8207-227aec2fe4bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -520
      ],
      "parameters": {
        "width": 500,
        "height": 840,
        "content": "## 3. Extract text from the files\n\n### Use the built-in n8n extractor tools to convert different file formats: PDF, txt, or markdown to plain text.\n\n"
      }
    },
    {
      "id": "879324fc-275a-4e5f-b23d-d9a3369d86ac",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -380
      ],
      "parameters": {
        "width": 500,
        "height": 840,
        "content": "## 4. Save the file to InfraNodus\n\n### Save the text content of the file to the graph, using its name as category (so you can manually delete it after) and additional processing settings (in the `body"
      }
    },
    {
      "id": "de8c6bde-5576-44d4-9bdf-8e36e22ff00d",
      "name": "Map PDF to Text",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        -100
      ]
    },
    {
      "id": "571a5204-afae-4329-9d87-c0474dadb20b",
      "name": "New File Created in the Google Folder?",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -480,
        -100
      ]
    },
    {
      "id": "dda0c5dc-b90f-4ca9-b662-387ee7166985",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1820,
        -380
      ],
      "parameters": {
        "width": 500,
        "height": 840,
        "content": "## Optional: Better PDF Conversion\n\n### Standard Map PDF to Text node will split your PDF files into very short chunks, which deteriorates retrieval. \n\nUse can use [ConvertAPI](https://convertapi.com?"
      }
    },
    {
      "id": "a3461e66-7325-47aa-a56a-3cafceb44d15",
      "name": "Convert File to PDF",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1880,
        0
      ]
    },
    {
      "id": "84c03b58-a47f-4465-a9bc-f7ad050bcdc6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -1420
      ],
      "parameters": {
        "width": 1060,
        "height": 980,
        "content": "# Sync Google Drive files to an InfraNodus graph\n\n## This workflow listens to newly added files in the Google Drive folder you specify and automatically uploads it to a new or existing [InfraNodus gra"
      }
    }
  ],
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Extract from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from Text File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from Markdown",
            "type": "main",
            "index": 0
          }
        ],
        [],
        []
      ]
    },
    "Retrieve File": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Retrieve File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map PDF to Text": {
      "main": [
        [
          {
            "node": "InfraNodus Save to Graph",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from PDF": {
      "main": [
        [
          {
            "node": "Map PDF to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from Markdown": {
      "main": [
        [
          {
            "node": "InfraNodus Save to Graph",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from Text File": {
      "main": [
        [
          {
            "node": "InfraNodus Save to Graph",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "InfraNodus Save to Graph": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New File Created in the Google Folder?": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}