{
  "name": "Create & validate digital certificates with PDF Generator API and Gmail",
  "nodes": [
    {
      "id": "8aa6949f-3935-4b5f-993e-58109ae2dc46",
      "name": "Insert_Certificaton",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        320,
        -224
      ]
    },
    {
      "id": "5276e288-b7e2-4e82-8038-6ed25283e9f9",
      "name": "Generate_Certification_ID",
      "type": "n8n-nodes-base.code",
      "position": [
        -352,
        -240
      ]
    },
    {
      "id": "17def385-21b1-4479-86aa-bcf99964bc26",
      "name": "Find_Certification_By_ID",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -144,
        -240
      ]
    },
    {
      "id": "aa33fda6-c7d7-419b-ac65-6888e4939b8b",
      "name": "Certification_ID_Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        64,
        -240
      ]
    },
    {
      "id": "a3a47b41-ddff-45ee-8ffc-74ab0ed0cb06",
      "name": "Email_Certification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        736,
        -224
      ]
    },
    {
      "id": "29812013-9f2f-4211-bc0a-9d16fbc45f10",
      "name": "Webhook_Check",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -592,
        224
      ]
    },
    {
      "id": "0f02a5e6-368e-4d85-a95e-fa039a7670e0",
      "name": "Find_Certification_By_ID1",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -352,
        224
      ]
    },
    {
      "id": "9beea287-488e-425a-8185-aaf4938448e1",
      "name": "Certification_Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        -144,
        224
      ]
    },
    {
      "id": "1c363567-193e-45d4-9d43-82460a06fd83",
      "name": "Respond_Found",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        96,
        160
      ]
    },
    {
      "id": "9169c821-6fe5-43d3-83b2-2d47c4add2d9",
      "name": "Respond_NotFound",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        96,
        288
      ]
    },
    {
      "id": "e5d78a9d-74cf-494f-9057-d2de3a8d0691",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -448
      ],
      "parameters": {
        "width": 256,
        "height": 368,
        "content": "## Creation  \n## Webhook input\n\nReceives name, surname, course and email via HTTP POST on `/certifications`.  \nStarts the certificate creation flow.\n"
      }
    },
    {
      "id": "bb676994-7df9-4873-b260-8086c74ad6b1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -448
      ],
      "parameters": {
        "width": 864,
        "height": 368,
        "content": "## Creation – Generate & validate ID\n\nGenerates a random CertificationID, checks the Data Table for duplicates and only continues when the ID is unique.  \nIf the ID already exists, the flow loops unti"
      }
    },
    {
      "id": "b876bfd4-fd59-49ca-9386-9a55cd754a78",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -448
      ],
      "parameters": {
        "width": 448,
        "height": 368,
        "content": "## Creation – Save, PDF & email\n\nSaves the learner record with the CertificationID to the Data Table, generates the certificate PDF from an HTML template and emails it to the learner.\n"
      }
    },
    {
      "id": "80d9e416-5bde-4845-948d-f08ad893b737",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        32
      ],
      "parameters": {
        "width": 256,
        "height": 320,
        "content": "## Check – Webhook input\n\nReceives a CertificationID via HTTP POST on `/certificationscheck` and starts the verification flow.\n"
      }
    },
    {
      "id": "3e2d8f20-4f2c-4f9a-9948-455886e62039",
      "name": "Webhook_Creation",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -592,
        -240
      ]
    },
    {
      "id": "3adee942-b0b4-4bec-adaa-fe5bddc60f2d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        32
      ],
      "parameters": {
        "width": 432,
        "height": 320,
        "content": "## Check – Look up ID\n\nSearches the Certifications Data Table for the submitted CertificationID and branches depending on whether a matching record exists.\n"
      }
    },
    {
      "id": "cf2f8732-9ee6-4f3a-9022-836d788d66ce",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        176
      ],
      "parameters": {
        "width": 432,
        "height": 176,
        "content": "## Check – Responses\n\nReturns JSON to the caller.  \nIf the ID is found: `ok: true` plus name and surname.  \nIf not found: `ok: false` so the client can show an “invalid certification” message.\n"
      }
    },
    {
      "id": "338fc6e8-eb2e-4801-8a89-b4d8f35f86f2",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        -448
      ],
      "parameters": {
        "width": 640,
        "height": 560,
        "content": "## Certifications – Creator & Checker\n\n## How it works\nThis workflow manages the full lifecycle of a training certificate.  \n`/certifications` receives learner details, generates a unique Certificatio"
      }
    },
    {
      "id": "33d6d124-643b-4cb5-b7bc-a78266aaefec",
      "name": "Generate a PDF document",
      "type": "@pdfgeneratorapi/n8n-nodes-pdf-generator-api.pdfGeneratorApi",
      "position": [
        544,
        -224
      ]
    }
  ],
  "connections": {
    "Webhook_Check": {
      "main": [
        [
          {
            "node": "Find_Certification_By_ID1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook_Creation": {
      "main": [
        [
          {
            "node": "Generate_Certification_ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert_Certificaton": {
      "main": [
        [
          {
            "node": "Generate a PDF document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Certification_Exists": {
      "main": [
        [
          {
            "node": "Respond_Found",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond_NotFound",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Certification_ID_Exists": {
      "main": [
        [
          {
            "node": "Generate_Certification_ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Insert_Certificaton",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a PDF document": {
      "main": [
        [
          {
            "node": "Email_Certification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find_Certification_By_ID": {
      "main": [
        [
          {
            "node": "Certification_ID_Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find_Certification_By_ID1": {
      "main": [
        [
          {
            "node": "Certification_Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate_Certification_ID": {
      "main": [
        [
          {
            "node": "Find_Certification_By_ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}