{
  "nodes": [
    {
      "id": "3c7ae816-6ce2-4b6b-893e-75c6b8756555",
      "name": "Trigger - New Email",
      "type": "n8n-nodes-base.gmailTrigger",
      "notes": "has:attachment",
      "position": [
        680,
        300
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "q": "has:attachment"
        },
        "options": {
          "downloadAttachments": true
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "b87b2211-03d3-4742-98c9-977ae4a8d581",
      "name": "attach binary data outputs",
      "type": "n8n-nodes-base.function",
      "position": [
        900,
        300
      ],
      "parameters": {
        "functionCode": "let results = [];\n\nfor (item of items) {\n    for (key of Object.keys(item.binary)) {\n        results.push({\n            json: {\n                fileName: item.binary[key].fileName\n            },\n            binary: {\n                data: item.binary[key],\n            }\n        });\n    }\n}\n\nreturn results;"
      },
      "typeVersion": 1
    },
    {
      "id": "f8e19c97-0983-4365-bc63-179605050ef2",
      "name": "upload files to google drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1140,
        300
      ],
      "parameters": {
        "name": "={{ $json.fileName.split(\".\")[0] + \"-\" + $('Trigger - New Email').item.json.from.value[0].address + \".\" + $json.fileName.split(\".\")[1]}}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_RESOURCE"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_RESOURCE"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "542019dd-03e8-501a-81c4-967f7fee05ee",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# receive gmail events and upload files to google drive\n\n## Purpose and structure\nThis folder contains the **receive gmail events and upload files to google drive** workflow. Its executable nodes use `function`, `gmailTrigger`, `googleDrive`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nTrigger - New Email\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Gmail/0544_Gmail_GoogleDrive_Create_Triggered.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Trigger - New Email": {
      "main": [
        [
          {
            "node": "attach binary data outputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "attach binary data outputs": {
      "main": [
        [
          {
            "node": "upload files to google drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
