{
  "id": "",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Verified Building Visitor Entry Pass & Security Notification System",
  "tags": [],
  "nodes": [
    {
      "id": "c5c2f1f9-4d11-4746-bda7-13cdb965c51b",
      "name": "Sticky Note - Overview1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        640
      ],
      "parameters": {
        "width": 468,
        "height": 792,
        "content": "### How It Works\nThis workflow automates visitor onboarding by validating each registration, \ngenerating a unique entry pass with QR code, and delivering it instantly. \nWhen a visitor submits their details through the webhook, the workflow checks \nfor required fields, verifies the email using VerifiEmail, and routes invalid \nentries to a structured error response. For valid entries, it creates a unique \npass ID, generates a QR code, builds a formatted HTML entry pass, and converts \nit into a downloadable PDF. The pass is emailed to the visitor and a \nconfirmation notification is posted to Slack for the security/reception team.\n\n### Setup Steps\n1. Connect credentials: VerifiEmail, HTML-to-PDF service, Gmail, Slack.\n2. Replace placeholder values:\n   - Email sender name and company details\n   - Slack channel ID (set to your #security or #reception channel)\n   - Company logo URL in HTML template (optional)\n3. Copy the webhook URL and integrate with your visitor registration form.\n4. Test using a sample submission with a real email address.\n5. Activate the workflow to begin processing visitor registrations.\n\n### Use Cases\n- Corporate office visitor management\n- Co-working space day passes\n- Secure facility access control\n- Event/conference check-in\n- Contractor/vendor entry tracking"
      },
      "typeVersion": 1
    },
    {
      "id": "11c70946-2894-4f98-bd77-f6587288935d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        1152
      ],
      "parameters": {
        "color": 7,
        "width": 736,
        "height": 272,
        "content": "## Visitor Registration & Email Verification\nReceives visitor details and validates email deliverability before generating pass."
      },
      "typeVersion": 1
    },
    {
      "id": "6fdcfbcc-5f00-4462-9bcc-956c5421f978",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        1056
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 272,
        "content": "## Entry Pass Generation\nGenerates unique pass ID, QR code, and formatted PDF entry pass for the visitor."
      },
      "typeVersion": 1
    },
    {
      "id": "3601b7ef-7c86-4cf0-8917-2ce741260a19",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2336,
        1072
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 256,
        "content": "## Pass Distribution & Security Alert\nDelivers entry pass to visitor via email and notifies security/reception team through Slack."
      },
      "typeVersion": 1
    },
    {
      "id": "f0034f04-8d6d-4b8a-945e-ac056eb5e0dd",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        1488
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 240,
        "content": "## Error Handling\nReturns structured error responses for invalid submissions."
      },
      "typeVersion": 1
    },
    {
      "id": "5e7908bd-492b-4a20-be5a-31a191aa725e",
      "name": "Generate Entry Pass ID",
      "type": "n8n-nodes-base.function",
      "position": [
        1744,
        1152
      ],
      "parameters": {
        "functionCode": "const badgeId = \"ENTRY-\" + Date.now();  // Changed from \"SHIFT-\" to \"ENTRY-\"\nconst timestamp = new Date().toISOString();\n\n// Get the original webhook data\nconst webhookData = $('Receive Visitor Registration').item.json.body;\n\nreturn [{\n  json: {\n    ...webhookData,  // This preserves all visitor data\n    badge_id: badgeId,\n    timestamp: timestamp,\n    email: $('Verify Visitor Email').item.json.email  // Add email back from verification\n  }\n}];"
      },
      "typeVersion": 1
    },
    {
      "id": "0c6db00c-c5d5-4ef2-af8e-b0b307d584a0",
      "name": "Verify Visitor Email",
      "type": "n8n-nodes-verifiemail.verifiEmail",
      "position": [
        1136,
        1248
      ],
      "parameters": {
        "email": "={{ $json.body.visitor_email }}"
      },
      "credentials": {
        "verifiEmailApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f678f5b4-878f-4cf6-801a-c41ce0f0b4f4",
      "name": "Receive Visitor Registration",
      "type": "n8n-nodes-base.webhook",
      "position": [
        864,
        1248
      ],
      "parameters": {
        "path": "volunteer-shift",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "5c368efe-2514-47bc-9cb5-1821194b120f",
      "name": "Check Email Validity",
      "type": "n8n-nodes-base.if",
      "position": [
        1392,
        1248
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.valid }}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9d884e72-ae03-49ae-9a46-47b56a2fab27",
      "name": "Create QR Code for Pass",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1952,
        1152
      ],
      "parameters": {
        "url": "=https://api.qrserver.com/v1/create-qr-code/?data={{$json.badge_id}}&size=200x200&color=1A73E8&bgcolor=FFFFFF",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "6054bd22-2c58-4737-95f8-c0455783a906",
      "name": "Store QR Code URL",
      "type": "n8n-nodes-base.set",
      "position": [
        2160,
        1152
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b776dc31-1c89-4475-88a5-ada5598fc14a",
              "name": "qrcodeurl",
              "type": "string",
              "value": "={{$node[\"Create QR Code for Pass\"].parameter[\"url\"]}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9b70d418-5714-4d1a-9c0a-86fbaf4b7e31",
      "name": "Generate Entry Pass PDF",
      "type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
      "position": [
        2400,
        1152
      ],
      "parameters": {
        "html_content": "=<div style=\"font-family: Arial, sans-serif; width: 450px; border: 4px solid #1A73E8; border-radius: 15px; padding: 20px; text-align: center; background: #f8fbff; box-shadow: 0 8px 16px rgba(0,0,0,0.1);\">\n  <h2 style=\"color: #1A73E8; margin: 0;\">\ud83c\udfe2 Building Entry Pass</h2>\n  <hr style=\"border: 1px dashed #1A73E8; margin: 15px 0;\">\n  <h3 style=\"margin: 10px 0; color: #333;\">{{ $('Create QR Code for Pass').item.json.visit_purpose }}</h3>\n  \n  <p style=\"margin: 5px 0;\"><strong>Visitor:</strong> {{ $('Create QR Code for Pass').item.json.visitor_name }}</p>\n  <p style=\"margin: 5px 0;\"><strong>Host:</strong> {{ $('Create QR Code for Pass').item.json.host_name }}</p>\n  <p style=\"margin: 5px 0;\"><strong>Visit Date:</strong> {{ $('Create QR Code for Pass').item.json.visit_date }}</p>\n  <p style=\"margin: 5px 0;\"><strong>Location:</strong> {{ $('Create QR Code for Pass').item.json.building_location }}</p>\n  \n  <!-- QR CODE EMBEDDED HERE -->\n  <img \n    src=\"{{ $json.qrcodeurl }}\" \n    width=\"140\" \n    alt=\"Scan at Reception\"\n    style=\"margin: 20px 0; padding: 10px; background: white; border: 3px solid #1A73E8; border-radius: 12px;\"\n  >\n  \n  <p style=\"font-size: 13px; color: #444; margin: 10px 0;\">\n    <strong>Pass ID:</strong> <code style=\"background: #eee; padding: 2px 8px; border-radius: 4px;\">{{$('Create QR Code for Pass').item.json.badge_id}}</code>\n  </p>\n  \n  <p style=\"font-size: 10px; color: #888; margin: 5px 0;\">\n    Generated: {{ $('Create QR Code for Pass').item.json.timestamp.split(\"T\")[0] }} at {{ $('Create QR Code for Pass').item.json.timestamp.split(\"T\")[1].split(\".\")[0].slice(0,5) }} UTC\n  </p>\n  \n  <footer style=\"margin-top: 15px; font-size: 9px; color: #aaa;\">\n    Security Verified Entry Pass \u2022 Scan at Reception\n  </footer>\n</div>"
      },
      "credentials": {
        "htmlcsstopdfApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "03a47ad0-8542-478a-ba17-489fe8563e45",
      "name": "Send Pass to Visitor",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2624,
        1152
      ],
      "parameters": {
        "sendTo": "={{ $('Generate Entry Pass ID').item.json.visitor_email }}",
        "message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Your Verified Volunteer Shift Badge</title>\n  <style>\n    body {\n      margin: 0;\n      padding: 0;\n      background: #f4f6f9;\n      font-family: Arial, Helvetica, sans-serif;\n      color: #333;\n    }\n    .container {\n      max-width: 600px;\n      margin: 20px auto;\n      background: #ffffff;\n      border-radius: 12px;\n      overflow: hidden;\n      box-shadow: 0 8px 24px rgba(0,0,0,0.1);\n    }\n    .header {\n      background: linear-gradient(135deg, #1A73E8, #34A853);\n      padding: 30px 20px;\n      text-align: center;\n      color: white;\n    }\n    .header h1 {\n      margin: 0;\n      font-size: 28px;\n      font-weight: bold;\n    }\n    .header p {\n      margin: 10px 0 0;\n      font-size: 16px;\n      opacity: 0.9;\n    }\n    .badge {\n      padding: 30px;\n      text-align: center;\n      background: #f8fbff;\n    }\n    .badge h2 {\n      color: #1A73E8;\n      margin: 0 0 20px;\n      font-size: 24px;\n    }\n    .details {\n      background: white;\n      padding: 20px;\n      border-radius: 10px;\n      box-shadow: 0 4px 12px rgba(0,0,0,0.05);\n      margin: 20px 0;\n    }\n    .details p {\n      margin: 12px 0;\n      font-size: 16px;\n    }\n    .details strong {\n      color: #1A73E8;\n      width: 120px;\n      display: inline-block;\n    }\n    .qr-code {\n      margin: 25px 0;\n      padding: 15px;\n      background: white;\n      border: 4px solid #1A73E8;\n      border-radius: 16px;\n      display: inline-block;\n      box-shadow: 0 6px 16px rgba(26,115,232,0.2);\n    }\n    .qr-code img {\n      width: 160px;\n      height: 160px;\n    }\n    .badge-id {\n      font-family: monospace;\n      background: #e8f0fe;\n      padding: 8px 16px;\n      border-radius: 8px;\n      font-size: 18px;\n      font-weight: bold;\n      color: #1A73E8;\n      letter-spacing: 1px;\n    }\n    .footer {\n      background: #f0f4f8;\n      padding: 20px;\n      text-align: center;\n      font-size: 12px;\n      color: #666;\n    }\n    .button {\n      display: inline-block;\n      margin: 20px 0;\n      padding: 14px 32px;\n      background: #1A73E8;\n      color: white;\n      text-decoration: none;\n      font-weight: bold;\n      border-radius: 8px;\n      font-size: 16px;\n      box-shadow: 0 4px 12px rgba(26,115,232,0.3);\n    }\n    .button:hover {\n      background: #1557b0;\n    }\n    @media (max-width: 480px) {\n      .container { margin: 10px; }\n      .header h1 { font-size: 24px; }\n      .qr-code img { width: 140px; height: 140px; }\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <!-- Header -->\n    <div class=\"header\">\n      <h1>\ud83c\udfe2 Entry Pass Confirmed!</h1>\n<p>Your visitor pass is ready for {{ $('Create QR Code for Pass').item.json.visit_date }}</p>\n\n    <!-- Badge Content -->\n    <div class=\"badge\">\n      <h2>Visitor Entry Pass</h2>\n      \n      <div class=\"details\">\n        <p><strong>Visitor Name:</strong> {{ $('Create QR Code for Pass').item.json.visitor_name }}</p>\n<p><strong>Email:</strong> {{ $('Create QR Code for Pass').item.json.visitor_email }}</p>\n<p><strong>Host:</strong> {{ $('Create QR Code for Pass').item.json.host_name }}</p>\n<p><strong>Visit Date:</strong> {{ $('Create QR Code for Pass').item.json.visit_date }}</p>\n<p><strong>Location:</strong> {{ $('Create QR Code for Pass').item.json.building_location }}</p>\n<p><strong>Purpose:</strong> {{ $('Create QR Code for Pass').item.json.visit_purpose }}</p>\n      </div>\n\n      <!-- QR Code -->\n      <div class=\"qr-code\">\n        <img src=\"{{ $('Store QR Code URL').item.json.qrcodeurl }}\" alt=\"Scan to Verify\">\n      </div>\n\n      <div class=\"badge-id\">{{ $('Generate Entry Pass ID').item.json.badge_id }}</div>\n\n      <p style=\"margin: 20px 0; font-size: 14px; color: #666;\">\n        Generated on: {{ $('Generate Entry Pass ID').item.json.timestamp.split(\"T\")[0]}} at {{ $('Generate Entry Pass ID').item.json.timestamp.split(\"T\")[1].split(\".\")[0].slice(0,5)}} UTC\n      </p>\n\n      <a href=\"{{ $json.pdf_url }}\" class=\"button\">Download Badge Image</a>\n    </div>\n\n    <!-- Instructions -->\n    <div style=\"padding: 0 30px 30px; text-align: center;\">\n      <h3>Entry Pass Instructions</h3>\n<ol>\n  <li>Present this pass at the reception desk</li>\n  <li>Security will scan your QR code for instant verification</li>\n  <li>Print the PDF or show on your mobile device</li>\n  <li>Please arrive 5 minutes before your scheduled visit</li>\n</ol>\n<p>We look forward to your visit! \ud83c\udfe2</p>\n    </div>\n\n    <!-- Footer -->\n    <div class=\"footer\">\n      <p>Security & Reception Team \u2022 [Your Company Name]</p>\n<p>Need help? Reply to this email or contact reception@yourcompany.com</p>\n      <p><small>This is an automated message. Badge ID:{{ $('Generate Entry Pass ID').item.json.badge_id }} </small></p>\n    </div>\n  </div>\n</body>\n</html>",
        "options": {},
        "subject": "=Your Verified Building Entry Pass - {{ $('Generate Entry Pass ID').item.json.visit_date }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f022a244-1f19-413c-82f5-fe7aba9300f8",
      "name": "Notify Security Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        2816,
        1152
      ],
      "parameters": {
        "text": "=\ud83c\udfe2 *New Visitor Entry Pass Generated*\n\n\ud83d\udc64 **Visitor:** {{ $('Receive Visitor Registration').item.json.body.visitor_name }}\n\ud83c\udfe2 **Company:** {{ $('Receive Visitor Registration').item.json.body.company_name }} *(if provided)*\n\ud83d\udc54 **Host:** {{ $('Receive Visitor Registration').item.json.body.host_name }}\n\ud83d\udcc5 **Visit Date:** {{ $('Receive Visitor Registration').item.json.body.visit_date }}\n\ud83d\udccd **Location:** {{ $('Receive Visitor Registration').item.json.body.building_location }}\n\ud83c\udfaf **Purpose:** {{ $('Receive Visitor Registration').item.json.body.visit_purpose }}\n\ud83d\udce7 **Email:** {{ $('Receive Visitor Registration').item.json.body.visitor_email }} (Verified \u2705)\n\n\ud83c\udd94 **Pass ID:** `{{ $('Generate Entry Pass ID').item.json.badge_id }}`\n*Generated:* {{ $('Generate Entry Pass ID').item.json.timestamp }}\n\n\ud83d\udd17 **QR Preview:** {{ $('Store QR Code URL').item.json.qrcodeurl }}\n*(Scan-ready for reception desk)*\n\n\ud83d\udcc4 **Digital Pass:** {{ $('Generate Entry Pass PDF').item.json.pdf_url }}\n*Forward to reception or print for manual verification*\n\n\u26a0\ufe0f **Action Required:**\n- Notify reception desk of expected visitor\n- Ensure host {{ $('Receive Visitor Registration').item.json.body.host_name }} is available\n- Prepare visitor badge/access card if needed\n\n_Automated Security System \u2022 n8n Workflow_",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "YOUR_SLACK_CHANNEL_NAME"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ac0b1f3e-5138-4526-9dc3-6b251669cb7f",
      "name": "Confirm Pass Generated",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3024,
        1152
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={\n  \"success\": true,\n  \"message\": \"Entry pass generated and sent!\",\n  \"pass_id\": \"{{ $('Generate Entry Pass ID').item.json.badge_id }}\",\n  \"visitor\": \"{{ $('Generate Entry Pass ID').item.json.visitor_name }}\",\n  \"visit_date\": \"{{ $('Generate Entry Pass ID').item.json.visit_date }}\"\n}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "9ac940ff-97dd-4a30-a42f-c0fe8fb8789d",
      "name": "Set Invalid Email Error",
      "type": "n8n-nodes-base.set",
      "position": [
        1776,
        1584
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "error",
              "value": "Invalid or disposable email."
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "id": "d6e5890c-662f-41bc-bc4d-5f3563ac898d",
      "name": "Return Error Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2048,
        1584
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Store QR Code URL": {
      "main": [
        [
          {
            "node": "Generate Entry Pass PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Email Validity": {
      "main": [
        [
          {
            "node": "Generate Entry Pass ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Invalid Email Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Security Team": {
      "main": [
        [
          {
            "node": "Confirm Pass Generated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Pass to Visitor": {
      "main": [
        [
          {
            "node": "Notify Security Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Visitor Email": {
      "main": [
        [
          {
            "node": "Check Email Validity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Entry Pass ID": {
      "main": [
        [
          {
            "node": "Create QR Code for Pass",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create QR Code for Pass": {
      "main": [
        [
          {
            "node": "Store QR Code URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Entry Pass PDF": {
      "main": [
        [
          {
            "node": "Send Pass to Visitor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Invalid Email Error": {
      "main": [
        [
          {
            "node": "Return Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Visitor Registration": {
      "main": [
        [
          {
            "node": "Verify Visitor Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}