{
  "id": "zSkkpUyHLX7KGoWf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Event Registration And Reminder Automation (Pre-Event + Event Day)",
  "tags": [],
  "nodes": [
    {
      "id": "84619214-27ec-4fdd-ad5d-b1ff93c1636c",
      "name": "Read Existing Registrations2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        608,
        2368
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "e77b0f4a-3ed7-4e7e-ab7b-eb88764aa99b",
      "name": "If Not Duplicate2",
      "type": "n8n-nodes-base.if",
      "position": [
        1040,
        2368
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.isDuplicate }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a53b6c74-2983-45d5-ae27-bd9607c65356",
      "name": "Event Registration Form3",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -224,
        2368
      ],
      "parameters": {
        "path": "530dbca7-33ec-4add-a37b-e44ee5fe7e41",
        "options": {},
        "formTitle": "Event Registration",
        "formFields": {
          "values": [
            {
              "fieldLabel": "First Name",
              "requiredField": true
            },
            {
              "fieldLabel": "Last Name",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email",
              "requiredField": true
            },
            {
              "fieldLabel": "Company",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Interests",
              "fieldOptions": {
                "values": [
                  {
                    "option": "n8n"
                  },
                  {
                    "option": "automation"
                  },
                  {
                    "option": "ai-agent"
                  },
                  {
                    "option": "digital-worker"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "formDescription": "Register for our upcoming event"
      },
      "typeVersion": 2
    },
    {
      "id": "1956a1a2-0605-4996-8ac1-301991383cb8",
      "name": "Check for Duplicate Email2",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        2368
      ],
      "parameters": {
        "jsCode": "// Get the form submission data\nconst formData = $('Event Registration Form3').first().json;\nconst submittedEmail = formData.Email.toLowerCase().trim();\n\n// Get all existing registrations from the sheet\nconst existingRegistrations = $('Read Existing Registrations2').all();\n\n// Check if email already exists\nconst isDuplicate = existingRegistrations.some(item => {\n  const existingEmail = item.json.Email;\n  if (existingEmail) {\n    return existingEmail.toLowerCase().trim() === submittedEmail;\n  }\n  return false;\n});\n\n// Return the form data with duplicate status\nreturn [{\n  json: {\n    ...formData,\n    isDuplicate: isDuplicate,\n    duplicateCheckAt: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "cdab6e67-08a1-435e-b9dd-b7491c8b9df9",
      "name": "Check Registration Success3",
      "type": "n8n-nodes-base.if",
      "position": [
        1776,
        2336
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.Status }}",
              "value2": "confirmed"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2260a659-8443-4665-a0bf-b25b7c404d46",
      "name": "Send Welcome Email3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2032,
        2240
      ],
      "parameters": {
        "sendTo": "={{ $json.Email }}",
        "message": "=<h2>Hello {{ $json['First Name'] }}</h2><p>Your registration is confirmed.</p>",
        "options": {},
        "subject": "Welcome to the Event!"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b0f144c8-b8f7-4a5a-97b6-2eeb0aa09dc1",
      "name": "Update Welcome Email Status3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2560,
        2240
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "Status": "={{ $json.Status }}",
            "Company": "={{ $json.Company }}",
            "Interests": "={{ $json.Interests }}",
            "Last Name": "={{ $json[\"Last Name\"] }}",
            "Event Date": "={{ $json[\"Event Date\"] }}",
            "First Name": "={{ $json[\"First Name\"] }}",
            "welcomeEmailSent": "={{ $json.welcomeEmailSent }}",
            "preEventEmailSent ": "={{ $json[\"preEventEmailSent \"] }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Interests",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Interests",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "preEventEmailSent ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "preEventEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "eventDayEmailSent ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "eventDayEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Event Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Event Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "welcomeEmailSent",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "welcomeEmailSent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "46d2e1d6-ce69-461c-962c-62651d8af59d",
      "name": "Store Registration (Google Sheets)3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1280,
        2272
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "Company": "={{ $json.Company }}",
            "Interests": "={{ $json.Interests }}",
            "Last Name": "={{ $json[\"Last Name\"] }}",
            "First Name": "={{ $json[\"First Name\"] }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Interests",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Interests",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "preEventEmailSent ",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "preEventEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "eventDayEmailSent ",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "eventDayEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Event Date",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Event Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "welcomeEmailSent",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "welcomeEmailSent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "dba5c770-e4b5-43c6-b16b-f5a01fc8cdde",
      "name": "Send Admin Alert3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2032,
        2416
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=<h3>Registration Failed</h3>\n<p>A registration attempt failed for:</p>\n<ul>\n<li>Name: {{ $json.firstName }} {{ $json.lastName }}</li>\n<li>Email: {{ $json.email }}</li>\n<li>Time: {{ $now.toISO() }}</li>\n</ul>\n<p>Please investigate.</p>",
        "options": {},
        "subject": "\u26a0\ufe0f Registration Failed for {{ $json.firstName }} {{ $json.lastName }}"
      },
      "typeVersion": 2
    },
    {
      "id": "22680c89-073d-40f8-8e9c-7701241a3a18",
      "name": "Code in JavaScript4",
      "type": "n8n-nodes-base.code",
      "position": [
        2288,
        2240
      ],
      "parameters": {
        "jsCode": "\nconst registrationData = $('Add Status & Event Date3').first().json;\n\n// Get the email send result from Gmail (contains id, threadId, labelIds)\nconst emailResult = $input.first().json;\n\n// Check if email was sent successfully (has an id)\nconst emailSentSuccessfully = emailResult.id ? true : false;\n\n// Return the original registration data so it can be used \n// in the \"Update Welcome Email Status\" node\nreturn [{\n  json: {\n    // All original registration fields\n    'First Name': registrationData['First Name'],\n    'Last Name': registrationData['Last Name'],\n    'Email': registrationData['Email'],\n    'Company': registrationData['Company'],\n    'Interests': registrationData['Interests'],\n    'Status': registrationData['Status'],\n    'preEventEmailSent ': registrationData['preEventEmailSent '], // Note: includes trailing space\n    'Event Date': registrationData['Event Date'],\n    \n    // Add confirmation that email was sent\n    'welcomeEmailSent': 'True',\n    'emailSentAt': new Date().toISOString(),\n    'emailId': emailResult.id,\n    'emailThreadId': emailResult.threadId\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7f5149be-7295-4075-af7e-62b09567f8bc",
      "name": "Add Status & Event Date3",
      "type": "n8n-nodes-base.set",
      "position": [
        1536,
        2336
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "First Name",
              "stringValue": "={{ $json[\"First Name\"] }}"
            },
            {
              "name": "Last Name",
              "stringValue": "={{ $json[\"Last Name\"] }}"
            },
            {
              "name": "Email",
              "stringValue": "={{ $json.Email }}"
            },
            {
              "name": "Company",
              "stringValue": "={{ $json.Company }}"
            },
            {
              "name": "Interests",
              "stringValue": "={{ $json.Interests }}"
            },
            {
              "name": "Status",
              "stringValue": "confirmed"
            },
            {
              "name": "preEventEmailSent ",
              "type": "booleanValue",
              "booleanValue": "false"
            },
            {
              "name": "Event Date",
              "stringValue": "20-12-2025"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "fe122d0e-6cbe-4743-a663-1b58e4fe7fac",
      "name": "Get Confirmed Aptitude Candidates2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        576,
        2848
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "aedbc6ad-c34e-4631-8b4c-417b71a07217",
      "name": "Filter Reminder Candidates2",
      "type": "n8n-nodes-base.code",
      "position": [
        832,
        2848
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst today = new Date();\ntoday.setHours(0, 0, 0, 0);\n\nconst reminderCandidates = items.filter(item => {\n  const data = item.json;\n  \n  // Only process confirmed registrations\n  if (data.Status !== 'confirmed') {\n    return false;\n  }\n  \n  // Parse the event date (format: DD-MM-YYYY)\n  const eventDateParts = data['Event Date'].split('-');\n  const eventDate = new Date(\n    parseInt(eventDateParts[2]), // year\n    parseInt(eventDateParts[1]) - 1, // month (0-indexed)\n    parseInt(eventDateParts[0]) // day\n  );\n  eventDate.setHours(0, 0, 0, 0);\n  \n  // Calculate days until event\n  const diffTime = eventDate - today;\n  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\n  \n  // Check for 3-day reminder or event day reminder\n  const is3DayReminder = (diffDays === 3 && data['preEventEmailSent '] === false);\n  const isEventDayReminder = (diffDays === 0 && (!data['eventDayEmailSent '] || data['eventDayEmailSent '] === false));\n  \n  return is3DayReminder || isEventDayReminder;\n});\n\n// Add reminder type to each item\nconst processedItems = reminderCandidates.map(item => {\n  const data = item.json;\n  const eventDateParts = data['Event Date'].split('-');\n  const eventDate = new Date(\n    parseInt(eventDateParts[2]),\n    parseInt(eventDateParts[1]) - 1,\n    parseInt(eventDateParts[0])\n  );\n  eventDate.setHours(0, 0, 0, 0);\n  \n  const diffTime = eventDate - today;\n  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));\n  \n  return {\n    json: {\n      ...data,\n      reminderType: diffDays === 3 ? '3-day' : 'event-day',\n      daysUntilEvent: diffDays\n    }\n  };\n});\n\nreturn processedItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "a38a55b9-0dcd-48a3-8eb7-066668f3bcb0",
      "name": "Switch Reminder Type2",
      "type": "n8n-nodes-base.switch",
      "position": [
        1072,
        2848
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "3DayReminder",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c315b782-3a2a-4341-9578-df47529bbdac",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.reminderType }}",
                    "rightValue": "3-day"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "EventDayReminder",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "28765d9b-8b9c-439b-8b4d-bc5bb384992a",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.reminderType }}",
                    "rightValue": "event-day"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "6f595286-b68e-4af2-9c4b-b23ca19e73d5",
      "name": "Loop 3-Day2",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1584,
        2688
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a5cb7979-b97f-4514-8f8e-0487d70c592a",
      "name": "Send 3-Day Reminder2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1824,
        2688
      ],
      "parameters": {
        "sendTo": "={{ $json.Email }}",
        "message": "=<h2>Hi {{ $json['First Name'] }}!</h2>\n<p>Your event is just 3 days away.</p>\n<p><strong>Your Interests:</strong> {{ $json.Interests }}</p>\n<p>We've prepared sessions based on what you like.</p>\n<p>See you soon!<br>Event Team</p>",
        "options": {},
        "subject": "Your Personalized Agenda for [Event Name]"
      },
      "typeVersion": 2
    },
    {
      "id": "d07fca2b-5352-482d-a3aa-ec02a02fb9c9",
      "name": "Wait5",
      "type": "n8n-nodes-base.wait",
      "position": [
        2304,
        2688
      ],
      "parameters": {
        "unit": "seconds"
      },
      "typeVersion": 1
    },
    {
      "id": "b4dfe64c-1d83-4e82-a199-16530b2b3d9c",
      "name": "Loop Event-Day2",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1584,
        2928
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "73248631-1749-4fc2-9d84-609a4bf486ff",
      "name": "Send Event-Day Reminder2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1824,
        2928
      ],
      "parameters": {
        "sendTo": "={{ $json.Email }}",
        "message": "=<h2>Good morning {{ $json['First Name'] }}!</h2>\n<p>Today is the event \ud83c\udf89</p>\n<ul>\n<li>\ud83d\udccd Venue: [Event Location]</li>\n<li>\ud83d\udd58 Check-in starts at 8:00 AM</li>\n<li>\ud83c\udfab Your badge will be ready at the entrance</li>\n</ul>\n<p>See you soon!<br>Event Team</p>",
        "options": {},
        "subject": "\ud83d\udcc5 Event Day Details & Check-in Info"
      },
      "typeVersion": 2
    },
    {
      "id": "133b5b42-3ef9-4fc8-87db-88fae58b7d39",
      "name": "Wait6",
      "type": "n8n-nodes-base.wait",
      "position": [
        2304,
        2928
      ],
      "parameters": {
        "unit": "seconds"
      },
      "typeVersion": 1
    },
    {
      "id": "2fe1e490-bfa2-4ea9-84c7-ffc0c9ed7205",
      "name": "Prepare 3-Day Update2",
      "type": "n8n-nodes-base.code",
      "position": [
        2064,
        2688
      ],
      "parameters": {
        "jsCode": "const registrationData = $('Loop 3-Day2').first().json;\nconst emailResult = $input.first().json;\n\nreturn [{\n  json: {\n    // 'Email': registrationData.Email,\n    // 'preEventEmailSent ': true,\n    // 'Event Date': registrationData['Event Date'],\n    // 'emailId': emailResult.id,\n    // 'emailThreadId': emailResult.threadId,\n    // 'sentAt': new Date().toISOString(),\n\n    'First Name': registrationData['First Name'],\n    'Last Name': registrationData['Last Name'],\n    'Email': registrationData['Email'],\n    'Company': registrationData['Company'],\n    'Interests': registrationData['Interests'],\n    'Status': registrationData['Status'],\n    'preEventEmailSent ': true,\n    'eventDayEmailSent ': false,\n    'Event Date': registrationData['Event Date'],\n    'emailId': emailResult.id,\n    'sentAt': new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "ff7107a5-c96b-4c86-8519-9bc567dfb19e",
      "name": "Prepare Event-Day Update2",
      "type": "n8n-nodes-base.code",
      "position": [
        2064,
        2928
      ],
      "parameters": {
        "jsCode": "const registrationData = $('Loop Event-Day2').first().json;\nconst emailResult = $input.first().json;\n\nreturn [{\n  json: {\n    // 'Email': registrationData.Email,\n    // 'eventDayEmailSent ': true,\n    // 'emailId': emailResult.id,\n    // 'emailThreadId': emailResult.threadId,\n    // 'sentAt': new Date().toISOString()\n\n    'First Name': registrationData['First Name'],\n    'Last Name': registrationData['Last Name'],\n    'Email': registrationData['Email'],\n    'Company': registrationData['Company'],\n    'Interests': registrationData['Interests'],\n    'Status': registrationData['Status'],\n    'preEventEmailSent ': registrationData['preEventEmailSent '],\n    'eventDayEmailSent ': true,\n    'Event Date': registrationData['Event Date'],\n    'emailId': emailResult.id\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1117508c-d3f4-42f3-9a75-5c44d573e319",
      "name": "Update Event-Day Status2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2544,
        2928
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "eventDayEmailSent ": "={{ $json['eventDayEmailSent '] }}"
          },
          "schema": [
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "eventDayEmailSent ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "eventDayEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ]
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "2a2f7f9a-a86b-4faa-b4eb-5efc358aa650",
      "name": "Update 3-Day Status3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2528,
        2688
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "eventDayEmailSent ": "={{ $json[\"eventDayEmailSent \"] }}",
            "preEventEmailSent ": "={{ $json['preEventEmailSent '] }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Interests",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Interests",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "preEventEmailSent ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "preEventEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "eventDayEmailSent ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "eventDayEmailSent ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Event Date",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Event Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "welcomeEmailSent",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "welcomeEmailSent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet",
          "cachedResultUrl": "your-google-sheet-url",
          "cachedResultName": "your-google-sheet"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "68cdbd91-df76-4831-953f-cca014a5d8d6",
      "name": "Schedule Trigger2",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -240,
        2848
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4c7c9e52-5257-4fba-8609-1e7002ab6152",
      "name": "Edit Fields4",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        2368
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0f89b10c-0135-4df0-a56e-64b9ae1cce3c",
              "name": "source",
              "type": "string",
              "value": "form"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "0b7a74ca-c1bf-46ff-a150-564e71fb3869",
      "name": "Edit Fields5",
      "type": "n8n-nodes-base.set",
      "position": [
        -32,
        2848
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "49da74f2-c3c8-4e26-87d6-fefd53b48c46",
              "name": "source",
              "type": "string",
              "value": "schedule"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cbe773e8-0fe4-402c-a258-fbcd1822cee6",
      "name": "Switch2",
      "type": "n8n-nodes-base.switch",
      "position": [
        304,
        2672
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a0d9a748-7a81-4461-b38c-fc8f0f928304",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.source }}",
                    "rightValue": "form"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4f525d9a-ba0b-4ad6-af4a-b0008629e3be",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.source }}",
                    "rightValue": "schedule"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "35f7afdb-902e-4e83-b1b1-8bb8ab6dba85",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        2112
      ],
      "parameters": {
        "width": 880,
        "height": 1024,
        "content": "## Event Registration Automation with Email Workflow\nThis automation manages the complete event registration lifecycle\u2014from form submission to event day reminders. It prevents duplicate registrations, sends personalized welcome emails, and delivers timely reminders based on attendee interests.\n\n### How It Works\n### Registration Flow:\n- Captures registrations through a web form (First Name, Last Name, Email, Company, Interests)\n- Checks for duplicate emails against existing registrations\n- Stores new registrations in Google Sheets with \"confirmed\" status\n- Sends personalized welcome emails immediately upon successful registration\n- Updates spreadsheet to track email delivery status\n- Sends admin alerts if registration fails\n\n### Automated Reminder System:\n- Runs daily at 9 AM via scheduled trigger\n- Scans all confirmed registrations for upcoming events\n- Sends 3-day advance reminder with personalized agenda based on interests\n- Sends event-day reminder with check-in details and venue information\n- Updates tracking flags (preEventEmailSent, eventDayEmailSent) to prevent duplicate emails\n- Processes reminders in batches with small delays between sends\n\n### Setup steps\n1. Connect Google Sheets: Link your Google Sheets account and select the \"Event Registrations\" spreadsheet\n2. Connect Gmail: Authenticate your Gmail account for sending welcome and reminder emails\n3. Copy the form webhook URL: Find the webhook URL from the \"Event Registration Form2\" node\n4. Customize the form: Modify form fields, dropdown options (interests), and form title/description as needed\n5. Set event date: Update the event date in \"Add Status & Event Date2\" node (format: DD-MM-YYYY)\n6. Customize email content: Edit email templates in nodes: \"Send Welcome Email2\", \"Send 3-Day Reminder1\", and \"Send Event-Day Reminder1\"\n7. Configure admin email: Update admin email address in \"Send Admin Alert2\" node\n8. Set reminder schedule: Adjust the daily trigger time in \"Schedule Trigger1\" if needed (default: 9 AM)\n9. Turn the workflow ON\n10. Test the registration: Submit a test registration through the form and verify all emails are received"
      },
      "typeVersion": 1
    },
    {
      "id": "89f1765f-1d79-4b44-9282-2f2ee34fece1",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        2112
      ],
      "parameters": {
        "color": 7,
        "width": 1744,
        "height": 448,
        "content": "## Step 1: Capture and Process Registration\nWhen a user submits the event registration form, the workflow first verifies the submission using a Switch node if the form is submitted. It then checks whether the submitted email already exists in the system.If no duplicate is found, the registration data is stored in Google Sheets.If a duplicate email is detected, the workflow stops to prevent duplicate entries."
      },
      "typeVersion": 1
    },
    {
      "id": "dd1f38d9-a2c1-4189-8c66-9683027799fa",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1504,
        2112
      ],
      "parameters": {
        "color": 7,
        "width": 1312,
        "height": 448,
        "content": "## Step 2: Confirm Registration and Send Notifications\nAfter the registration data is stored, the system assigns a confirmed status and event date to the entry. It then checks whether the registration is successful and sends a welcome email to the attendee if confirmed. Once the email is sent, the workflow updates the email status for tracking purposes. If the registration fails, an alert email is automatically sent to the admin for review."
      },
      "typeVersion": 1
    },
    {
      "id": "837d8655-8090-4c8d-8cd9-c77e99f94fff",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        2576
      ],
      "parameters": {
        "color": 7,
        "width": 1536,
        "height": 560,
        "content": "## Step 3: Scheduled Trigger and Reminder Routing\nWhen the schedule trigger runs, the workflow first uses a Switch node to confirm the execution source is the scheduled run and not a form submission. Once validated, it fetches all confirmed event registrations from Google Sheets and calculates the days remaining until each event. Based on this calculation, attendees are classified into 3-day reminder or event-day reminder groups and routed to the appropriate reminder flow."
      },
      "typeVersion": 1
    },
    {
      "id": "15082637-439f-47ad-af52-1f39dc2045f4",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        2576
      ],
      "parameters": {
        "color": 7,
        "width": 1520,
        "height": 560,
        "content": "## Step 4: Send Reminders and Update Event Communication Status\nOnce reminder candidates are identified, the workflow processes them in batches to avoid overload. Attendees scheduled for a 3-day reminder receive a personalized email based on their interests, while event-day attendees receive final check-in and venue details. After each email is sent, the system updates the corresponding reminder status in Google Sheets, ensuring reminders are sent only once and tracking remains accurate."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e6df7d13-5132-4dee-b1a9-984d86fcdc00",
  "connections": {
    "Wait5": {
      "main": [
        [
          {
            "node": "Update 3-Day Status3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait6": {
      "main": [
        [
          {
            "node": "Update Event-Day Status2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch2": {
      "main": [
        [
          {
            "node": "Read Existing Registrations2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Confirmed Aptitude Candidates2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop 3-Day2": {
      "main": [
        [],
        [
          {
            "node": "Send 3-Day Reminder2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields4": {
      "main": [
        [
          {
            "node": "Switch2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields5": {
      "main": [
        [
          {
            "node": "Switch2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Event-Day2": {
      "main": [
        [],
        [
          {
            "node": "Send Event-Day Reminder2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Not Duplicate2": {
      "main": [
        [
          {
            "node": "Store Registration (Google Sheets)3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger2": {
      "main": [
        [
          {
            "node": "Edit Fields5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript4": {
      "main": [
        [
          {
            "node": "Update Welcome Email Status3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Welcome Email3": {
      "main": [
        [
          {
            "node": "Code in JavaScript4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send 3-Day Reminder2": {
      "main": [
        [
          {
            "node": "Prepare 3-Day Update2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update 3-Day Status3": {
      "main": [
        [
          {
            "node": "Loop 3-Day2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare 3-Day Update2": {
      "main": [
        [
          {
            "node": "Wait5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Reminder Type2": {
      "main": [
        [
          {
            "node": "Loop 3-Day2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Event-Day2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Status & Event Date3": {
      "main": [
        [
          {
            "node": "Check Registration Success3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Event Registration Form3": {
      "main": [
        [
          {
            "node": "Edit Fields4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Event-Day Reminder2": {
      "main": [
        [
          {
            "node": "Prepare Event-Day Update2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Event-Day Status2": {
      "main": [
        [
          {
            "node": "Loop Event-Day2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Event-Day Update2": {
      "main": [
        [
          {
            "node": "Wait6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Duplicate Email2": {
      "main": [
        [
          {
            "node": "If Not Duplicate2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Registration Success3": {
      "main": [
        [
          {
            "node": "Send Welcome Email3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Admin Alert3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Reminder Candidates2": {
      "main": [
        [
          {
            "node": "Switch Reminder Type2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Existing Registrations2": {
      "main": [
        [
          {
            "node": "Check for Duplicate Email2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Confirmed Aptitude Candidates2": {
      "main": [
        [
          {
            "node": "Filter Reminder Candidates2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Registration (Google Sheets)3": {
      "main": [
        [
          {
            "node": "Add Status & Event Date3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}