{
  "id": "G0pt8tHQhp8BCux7jGHmj",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "End-to-End Event e-Ticket Generator & Email Dispatcher",
  "tags": [],
  "nodes": [
    {
      "id": "852aa684-8b5c-4696-ba24-980bb5a0559b",
      "name": "Make Copy of Template",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        352,
        208
      ],
      "parameters": {
        "name": "=eTicket for {{ $json.TIKET }}",
        "fileId": {
          "__rl": true,
          "mode": "list",
          "value": "1XHUxOVyYThuCU_cNk2ArmfGQt_EZ0O2iJQMROs8aMgo",
          "cachedResultUrl": "https://docs.google.com/document/d/1XHUxOVyYThuCU_cNk2ArmfGQt_EZ0O2iJQMROs8aMgo/edit?usp=drivesdk",
          "cachedResultName": "QR Test"
        },
        "options": {},
        "operation": "copy"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "9ec8e2c7-14fa-499d-b359-103dbb86566f",
      "name": "Change Custom Variables",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        656,
        208
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "{kode_qr}",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json.TIKET }}"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $json.id }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "aa630c39-7f85-4808-994b-68c9e3cf03c5",
      "name": "Generate PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1184,
        208
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Change Custom Variables').item.json.documentId }}"
        },
        "options": {
          "binaryPropertyName": "data",
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "application/pdf"
            }
          }
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e3691717-b6e1-4acd-ae86-7404e72f7838",
      "name": "Add PDF To Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1376,
        208
      ],
      "parameters": {
        "name": "={{ $('Make Copy of Template').item.json.name }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1tOSzgdJn5x_-GAsqWgCU3isD-4UHQ7rB",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1tOSzgdJn5x_-GAsqWgCU3isD-4UHQ7rB",
          "cachedResultName": "eTicket"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "863ba140-aacf-4f58-99f3-bf99e7012088",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        64,
        208
      ],
      "parameters": {
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 474533520,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-4gs1e_OqrbioOlLfLyBi-8ERyR09NhMxYP9P8nNfLI/edit#gid=474533520",
          "cachedResultName": "QR Code Data"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1-4gs1e_OqrbioOlLfLyBi-8ERyR09NhMxYP9P8nNfLI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-4gs1e_OqrbioOlLfLyBi-8ERyR09NhMxYP9P8nNfLI/edit?usp=drivesdk",
          "cachedResultName": "Salinan dari QR Codes"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76062a36-1028-4114-ad51-9df9cfae01d5",
      "name": "Insert image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        896,
        208
      ],
      "parameters": {
        "url": "=https://docs.googleapis.com/v1/documents/{{$json.documentId}}:batchUpdate",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "text"
            }
          }
        },
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "requests",
              "value": "={{ [{ \"insertInlineImage\": { \"uri\": \"https://quickchart.io/qr?format=png&text=$('Google Sheets Trigger').item.json.TIKET\", \"location\": { \"segmentId\": \"\", \"index\": 27 } } }] }}"
            }
          ]
        },
        "nodeCredentialType": "googleDocsOAuth2Api"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "deb20927-c14d-45e1-981e-4454c0f99ec9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -192
      ],
      "parameters": {
        "width": 1552,
        "content": "\ud83d\ude80 **Automated e-Ticket PDF Generator > Created by Scale On Fajar**\n\nThis workflow automates the tedious process of generating event tickets. It takes incoming registration data, generates a dynamic QR Code, injects it into a Google Doc template along with personal details, and outputs a ready-to-send PDF file.\n\nPerfect for: Marathons, webinars, workshops, or any event requiring personalized passes.\nTip: Work smarter, scale mindfully!"
      },
      "typeVersion": 1
    },
    {
      "id": "98fe5ca7-e193-49a2-ab00-b9b79b42dd0b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        16
      ],
      "parameters": {
        "color": 5,
        "width": 304,
        "height": 448,
        "content": "\ud83d\udcca **1. The Data Source**\nThis workflow starts when a new participant registers.\nEnsure your data source (like Google Sheets or a Webhook) contains unique identifiers for the QR code (e.g., Ticket ID) and personal details (Name, Size, Blood Type)."
      },
      "typeVersion": 1
    },
    {
      "id": "7c85927b-5978-4c60-9c01-98625079b2be",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        16
      ],
      "parameters": {
        "color": 3,
        "width": 256,
        "height": 448,
        "content": "**3. Dynamic QR Code**\nThis HTTP Request node calls an API to generate a QR Code image based on the participant's unique ID. The binary output is then passed to the document in the next steps."
      },
      "typeVersion": 1
    },
    {
      "id": "dd865474-7b14-4172-9f3e-72ee52f10c93",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        16
      ],
      "parameters": {
        "width": 518,
        "height": 448,
        "content": "**2. Duplicate & Inject Data**\n\n1. We create a fresh copy of your master Google Doc template.\n2. We replace text placeholders (like {{nama_lengkap}}) with real data.\n3. We insert the generated QR Code binary image into the document.\n\nDon't forget to map your own Google Doc Template ID here!"
      },
      "typeVersion": 1
    },
    {
      "id": "48d6d62d-ac98-4835-8dc1-80d639b8fb3a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        16
      ],
      "parameters": {
        "color": 4,
        "width": 608,
        "height": 448,
        "content": "**\ud83d\udda8\ufe0f4. Export, Save & Distribute**\nFinally, the personalized Google Doc is downloaded as a PDF file and securely uploaded to a designated Google Drive folder. Once saved, the workflow uses the Mailketing node to automatically email the generated e-Ticket directly to the participant.\n\nPro-Tip: Make sure to connect your Mailketing/SMTP credentials and ensure your Google Drive folder is set to \"Anyone with the link can view\" so the attachment can be downloaded correctly."
      },
      "typeVersion": 1
    },
    {
      "id": "e2307c7b-b3ac-4b97-8681-c7fe9e552c5c",
      "name": "Send an Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1584,
        208
      ],
      "parameters": {
        "html": "=<!DOCTYPE html>\n<html>\n<head>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<style>\n  body {\n    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n    background-color: #f4f7f6;\n    margin: 0;\n    padding: 0;\n  }\n  .email-container {\n    max-width: 600px;\n    margin: 20px auto;\n    background-color: #ffffff;\n    border-radius: 8px;\n    overflow: hidden;\n    box-shadow: 0 4px 10px rgba(0,0,0,0.05);\n  }\n  .header {\n    background-color: #2c3e50;\n    color: #ffffff;\n    text-align: center;\n    padding: 25px 20px;\n  }\n  .header h2 {\n    margin: 0;\n    font-size: 24px;\n    font-weight: 600;\n  }\n  .content {\n    padding: 30px;\n    color: #333333;\n    line-height: 1.6;\n    font-size: 16px;\n  }\n  .ticket-box {\n    background-color: #f8f9fa;\n    border-left: 4px solid #3498db;\n    padding: 15px 20px;\n    margin: 25px 0;\n    border-radius: 4px;\n    font-size: 18px;\n  }\n  .btn-container {\n    text-align: center;\n    margin: 35px 0;\n  }\n  .btn {\n    display: inline-block;\n    background-color: #3498db;\n    color: #ffffff !important;\n    text-decoration: none;\n    padding: 14px 28px;\n    border-radius: 6px;\n    font-weight: bold;\n    font-size: 16px;\n  }\n  .footer {\n    background-color: #f9f9f9;\n    text-align: center;\n    padding: 20px;\n    font-size: 13px;\n    color: #888888;\n    border-top: 1px solid #eeeeee;\n  }\n  @media only screen and (max-width: 600px) {\n    .email-container {\n      width: 100% !important;\n      border-radius: 0;\n      margin: 0;\n    }\n    .content {\n      padding: 20px;\n    }\n  }\n</style>\n</head>\n<body>\n  <div class=\"email-container\">\n    <div class=\"header\">\n      <h2>Your Event e-Ticket \ud83c\udf9f\ufe0f</h2>\n    </div>\n    \n    <div class=\"content\">\n      <p>Hi <strong>{{ $('Google Sheets Trigger').item.json.NAMA }}</strong>,</p>\n      \n      <p>Thank you for registering for our upcoming event! We are thrilled to have you on board.</p>\n      \n      <p>Your official e-Ticket has been successfully generated. You can find your unique Ticket ID below:</p>\n      \n      <div class=\"ticket-box\">\n        Ticket ID: <strong>{{ $('Google Sheets Trigger').item.json.TIKET }}</strong>\n      </div>\n      \n      <p>For your convenience, we have attached a PDF version of your e-Ticket to this email. Please download and save it to your device, and simply show the QR code at the check-in desk on the day of the event.</p>\n      \n      <div class=\"btn-container\">\n        <a href=\"{{ $json.webContentLink }}\" class=\"btn\">Download e-Ticket PDF</a>\n      </div>\n      \n      <p>If you have any questions, feel free to reply to this email.</p>\n      <p>See you at the event!</p>\n      \n      <p>Best regards,<br>\n      <strong>The Event Team</strong></p>\n    </div>\n    \n    <div class=\"footer\">\n      <p>This is an automated message. Please have your QR code ready upon arrival for a faster check-in process.</p>\n    </div>\n  </div>\n</body>\n</html>",
        "options": {},
        "subject": "e-Ticket Resmi Anda untuk Event [Nama Event] \ud83c\udf9f\ufe0f",
        "toEmail": "={{ $('Google Sheets Trigger').item.json.Email }}",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "b3c1fca1-8836-47cf-af50-ba7d98be1888",
  "connections": {
    "Generate PDF": {
      "main": [
        [
          {
            "node": "Add PDF To Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert image": {
      "main": [
        [
          {
            "node": "Generate PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send an Email": {
      "main": [
        []
      ]
    },
    "Add PDF To Drive": {
      "main": [
        [
          {
            "node": "Send an Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Make Copy of Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Make Copy of Template": {
      "main": [
        [
          {
            "node": "Change Custom Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change Custom Variables": {
      "main": [
        [
          {
            "node": "Insert image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}