{
  "name": "Generate, encrypt, and send invoices with PDF Generator API & Google Suite",
  "nodes": [
    {
      "id": "e30f9a26-b270-41ea-b732-95df22a8b3ed",
      "name": "Generate Invoice ID",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        208
      ]
    },
    {
      "id": "5fb09b61-d55e-4b78-bdd8-cfc997737434",
      "name": "Check if ID Already Exists",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        688,
        208
      ]
    },
    {
      "id": "7a7132cf-2847-4dc6-812c-036339b6d30d",
      "name": "If Does not Exist",
      "type": "n8n-nodes-base.if",
      "position": [
        912,
        208
      ]
    },
    {
      "id": "23696cc6-71e0-4a5f-a391-5116024ad19d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        0
      ],
      "parameters": {
        "width": null,
        "height": 352,
        "content": "## Pinned TEST data \nThis pinned data simulates the test payload (JSON) from the Webhook. It contains sample customer and line item details needed to test the invoice generation."
      }
    },
    {
      "id": "32b3abc7-9cc3-4586-8bc2-10234c1071f2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        128
      ],
      "parameters": {
        "width": 656,
        "height": 288,
        "content": "## Generate a random INVOICE number and check for duplicities"
      }
    },
    {
      "id": "d0c8d1a6-02df-4038-af24-ee607f67a1ae",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        16
      ],
      "parameters": {
        "width": 224,
        "height": 528,
        "content": "## Generate a document and Encrypt"
      }
    },
    {
      "id": "1d61d3f5-251f-43b2-9d75-e916fc04c2ca",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        448
      ],
      "parameters": {
        "width": 624,
        "height": 272,
        "content": "## Upload the file and send the invoice to the customer"
      }
    },
    {
      "id": "e6b468a5-abc2-4a81-b7ec-a1fc133b7cfa",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        192,
        208
      ]
    },
    {
      "id": "c4a87e74-50e3-4e67-a313-9503502987e7",
      "name": "Generate a PDF document",
      "type": "@pdfgeneratorapi/n8n-nodes-pdf-generator-api.pdfGeneratorApi",
      "position": [
        1216,
        128
      ]
    },
    {
      "id": "44d10eb3-8b32-465d-8482-2bcd0791dd26",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -224
      ],
      "parameters": {
        "width": 464,
        "height": 224,
        "content": "## PDF Generator API\nThe PDF Generator API node connects to the pdfgeneratorapi.com service. In this workflow, it dynamically generates a PDF document (like an invoice) by populating a custom document"
      }
    },
    {
      "id": "afa73496-801f-4ad4-a412-045466d88175",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        496,
        560
      ]
    },
    {
      "id": "52a1e363-9295-4772-bdce-bbbe4027ebb9",
      "name": "Send a message + file",
      "type": "n8n-nodes-base.gmail",
      "position": [
        736,
        560
      ]
    },
    {
      "id": "2093fdde-1ea0-4237-8bba-d52c014b50b3",
      "name": "Encrypt PDF document",
      "type": "@pdfgeneratorapi/n8n-nodes-pdf-generator-api.pdfGeneratorApi",
      "position": [
        1216,
        352
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Generate Invoice ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Send a message + file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Does not Exist": {
      "main": [
        [
          {
            "node": "Generate a PDF document",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Invoice ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Invoice ID": {
      "main": [
        [
          {
            "node": "Check if ID Already Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encrypt PDF document": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a PDF document": {
      "main": [
        [
          {
            "node": "Encrypt PDF document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if ID Already Exists": {
      "main": [
        [
          {
            "node": "If Does not Exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}