{
  "nodes": [
    {
      "id": "1",
      "name": "Event Registration Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        240,
        300
      ],
      "parameters": {
        "path": "event-registration",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        180
      ],
      "parameters": {
        "width": 240,
        "height": 160,
        "content": "## Event Management Config\n\n\u2699\ufe0f **Customize event settings:**\n- Event details and schedules\n- Email templates by event type\n- Reminder timings\n- Capacity limits"
      },
      "typeVersion": 1
    },
    {
      "id": "3",
      "name": "Event Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        300
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "maxCapacity",
              "value": 100
            }
          ],
          "string": [
            {
              "name": "eventDate",
              "value": "2025-07-25T14:00:00Z"
            },
            {
              "name": "eventEndDate",
              "value": "2025-07-25T16:00:00Z"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4",
      "name": "Validate Registration",
      "type": "n8n-nodes-base.if",
      "position": [
        640,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "isNotEmpty"
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": ""
            },
            {
              "operator": {
                "type": "string",
                "operation": "isNotEmpty"
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": ""
            },
            {
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": "@"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5",
      "name": "Process Registration",
      "type": "n8n-nodes-base.code",
      "position": [
        840,
        300
      ],
      "parameters": {
        "jsCode": "// Process registration and generate unique details\nconst registration = $json;\nconst eventSettings = $node['Event Settings'].json;\n\n// Generate unique registration ID\nconst registrationId = `REG_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n\n// Calculate reminder dates\nconst eventDate = new Date(eventSettings.eventDate);\nconst reminderDates = {\n  weekBefore: new Date(eventDate.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString(),\n  dayBefore: new Date(eventDate.getTime() - 24 * 60 * 60 * 1000).toISOString(),\n  twoHoursBefore: new Date(eventDate.getTime() - 2 * 60 * 60 * 1000).toISOString()\n};\n\n// Generate calendar event data\nconst calendarEvent = {\n  summary: eventSettings.eventTitle,\n  start: eventSettings.eventDate,\n  end: eventSettings.eventEndDate,\n  location: eventSettings.eventLocation,\n  description: `Vous \u00eates inscrit(e) \u00e0 ${eventSettings.eventTitle}. D\u00e9tails: ${eventSettings.eventLocation}`\n};\n\n// Create access credentials for online events\nconst accessCredentials = {\n  meetingId: eventSettings.eventLocation.includes('zoom') ? 'ID: 123 456 789' : null,\n  accessCode: Math.random().toString(36).substr(2, 8).toUpperCase()\n};\n\nreturn {\n  ...registration,\n  registrationId,\n  eventDetails: eventSettings,\n  reminderDates,\n  calendarEvent,\n  accessCredentials,\n  registeredAt: new Date().toISOString(),\n  status: 'confirmed'\n};"
      },
      "typeVersion": 1
    },
    {
      "id": "6",
      "name": "Send Confirmation Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1040,
        300
      ],
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; margin: 20px; background-color: #f8f9fa; }\n    .container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; }\n    .header { text-align: center; margin-bottom: 30px; background: #007bff; color: white; padding: 20px; border-radius: 8px; }\n    .event-details { background: #e8f4f8; padding: 20px; margin: 20px 0; border-radius: 8px; }\n    .access-info { background: #d4edda; padding: 15px; margin: 15px 0; border-radius: 5px; border-left: 4px solid #28a745; }\n    .calendar-button { background: #28a745; color: white; padding: 15px 30px; text-decoration: none; border-radius: 5px; display: inline-block; margin: 20px 0; }\n    .next-steps { background: #fff3cd; padding: 15px; margin: 15px 0; border-radius: 5px; border-left: 4px solid #ffc107; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"header\">\n      <h2>\ud83c\udf89 Inscription Confirm\u00e9e !</h2>\n      <p>Merci {{ $json.name }}, votre place est r\u00e9serv\u00e9e</p>\n    </div>\n    \n    <div class=\"event-details\">\n      <h3>\ud83d\udcc5 D\u00e9tails de l'\u00c9v\u00e9nement</h3>\n      <p><strong>Titre:</strong> {{ $json.eventDetails.eventTitle }}</p>\n      <p><strong>Date:</strong> {{ new Date($json.eventDetails.eventDate).toLocaleDateString('fr-FR', { \n        weekday: 'long', \n        year: 'numeric', \n        month: 'long', \n        day: 'numeric', \n        hour: '2-digit', \n        minute: '2-digit' \n      }) }}</p>\n      <p><strong>Dur\u00e9e:</strong> 2 heures</p>\n      <p><strong>Format:</strong> En ligne</p>\n      <p><strong>Lieu:</strong> {{ $json.eventDetails.eventLocation }}</p>\n    </div>\n    \n    {{#if $json.accessCredentials.meetingId}}\n    <div class=\"access-info\">\n      <h3>\ud83d\udd11 Informations d'Acc\u00e8s</h3>\n      <p><strong>Lien de connexion:</strong> {{ $json.eventDetails.eventLocation }}</p>\n      <p><strong>{{ $json.accessCredentials.meetingId }}</strong></p>\n      <p><strong>Code d'acc\u00e8s:</strong> {{ $json.accessCredentials.accessCode }}</p>\n    </div>\n    {{/if}}\n    \n    <div style=\"text-align: center;\">\n      <a href=\"data:text/calendar;charset=utf8,BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nDTSTART:{{ $json.calendarEvent.start }}\nDTEND:{{ $json.calendarEvent.end }}\nSUMMARY:{{ $json.calendarEvent.summary }}\nLOCATION:{{ $json.calendarEvent.location }}\nDESCRIPTION:{{ $json.calendarEvent.description }}\nEND:VEVENT\nEND:VCALENDAR\" class=\"calendar-button\">\n        \ud83d\udcc5 Ajouter \u00e0 mon calendrier\n      </a>\n    </div>\n    \n    <div class=\"next-steps\">\n      <h3>\ud83d\udccb Prochaines \u00c9tapes</h3>\n      <ul>\n        <li>Vous recevrez un rappel 7 jours avant l'\u00e9v\u00e9nement</li>\n        <li>Un email de rappel sera envoy\u00e9 la veille</li>\n        <li>Les liens de connexion seront rappel\u00e9s 2h avant</li>\n        <li>Pr\u00e9parez vos questions pour la session Q&A</li>\n      </ul>\n    </div>\n    \n    <p style=\"color: #666; font-size: 14px; margin-top: 30px;\">\n      ID de r\u00e9servation: {{ $json.registrationId }}<br>\n      Pour toute question: {{ $json.eventDetails.organizerEmail }}\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "contentType": "html"
        },
        "subject": "\u2705 Confirmation d'inscription - {{ $json.eventDetails.eventTitle }}"
      },
      "typeVersion": 1
    },
    {
      "id": "7",
      "name": "Wait Until Week Before",
      "type": "n8n-nodes-base.wait",
      "position": [
        1240,
        200
      ],
      "parameters": {
        "unit": "days",
        "amount": 7,
        "resume": "={{ $json.reminderDates.weekBefore }}"
      },
      "typeVersion": 1
    },
    {
      "id": "8",
      "name": "Send Week Reminder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1440,
        200
      ],
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; margin: 20px; background-color: #f8f9fa; }\n    .container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; }\n    .reminder-header { text-align: center; margin-bottom: 30px; background: #ffc107; color: #212529; padding: 20px; border-radius: 8px; }\n    .countdown { background: #e9ecef; padding: 20px; margin: 20px 0; border-radius: 8px; text-align: center; }\n    .agenda { background: #f8f9fa; padding: 15px; margin: 15px 0; border-radius: 5px; }\n    .preparation { background: #d1ecf1; padding: 15px; margin: 15px 0; border-radius: 5px; border-left: 4px solid #17a2b8; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"reminder-header\">\n      <h2>\u23f0 Rappel - Plus qu'une semaine !</h2>\n      <p>{{ $json.eventDetails.eventTitle }}</p>\n    </div>\n    \n    <div class=\"countdown\">\n      <h3>\ud83d\uddd3\ufe0f Dans 7 jours</h3>\n      <p>{{ new Date($json.eventDetails.eventDate).toLocaleDateString('fr-FR', { \n        weekday: 'long', \n        year: 'numeric', \n        month: 'long', \n        day: 'numeric', \n        hour: '2-digit', \n        minute: '2-digit' \n      }) }}</p>\n    </div>\n    \n    <div class=\"agenda\">\n      <h3>\ud83d\udccb Programme de la Session</h3>\n      <ul>\n        <li>14h00 - 14h15 : Accueil et pr\u00e9sentation</li>\n        <li>14h15 - 15h00 : Pr\u00e9sentation principale</li>\n        <li>15h00 - 15h15 : Pause</li>\n        <li>15h15 - 15h45 : D\u00e9monstration pratique</li>\n        <li>15h45 - 16h00 : Questions & r\u00e9ponses</li>\n      </ul>\n    </div>\n    \n    <div class=\"preparation\">\n      <h3>\ud83c\udfaf Comment bien se pr\u00e9parer</h3>\n      <ul>\n        <li>Testez votre connexion internet</li>\n        <li>Pr\u00e9parez vos questions \u00e0 l'avance</li>\n        <li>Ayez un carnet pour prendre des notes</li>\n        <li>Rejoignez-nous 5 minutes avant le d\u00e9but</li>\n      </ul>\n    </div>\n    \n    <p style=\"color: #666; font-size: 14px; margin-top: 30px;\">\n      Lien de connexion: {{ $json.eventDetails.eventLocation }}<br>\n      Code d'acc\u00e8s: {{ $json.accessCredentials.accessCode }}\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "contentType": "html"
        },
        "subject": "\ud83d\udcc5 Rappel - {{ $json.eventDetails.eventTitle }} dans 7 jours"
      },
      "typeVersion": 1
    },
    {
      "id": "9",
      "name": "Wait Until Day Before",
      "type": "n8n-nodes-base.wait",
      "position": [
        1640,
        200
      ],
      "parameters": {
        "unit": "days",
        "amount": 6,
        "resume": "={{ $json.reminderDates.dayBefore }}"
      },
      "typeVersion": 1
    },
    {
      "id": "10",
      "name": "Send Day Before Reminder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1840,
        200
      ],
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; margin: 20px; background-color: #f8f9fa; }\n    .container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; }\n    .urgent-reminder { text-align: center; margin-bottom: 30px; background: #dc3545; color: white; padding: 20px; border-radius: 8px; }\n    .quick-access { background: #d4edda; padding: 20px; margin: 20px 0; border-radius: 8px; border-left: 4px solid #28a745; }\n    .final-details { background: #fff3cd; padding: 15px; margin: 15px 0; border-radius: 5px; border-left: 4px solid #ffc107; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"urgent-reminder\">\n      <h2>\ud83d\udea8 C'est demain !</h2>\n      <p>{{ $json.eventDetails.eventTitle }}</p>\n      <h3>{{ new Date($json.eventDetails.eventDate).toLocaleDateString('fr-FR', { \n        hour: '2-digit', \n        minute: '2-digit' \n      }) }}</h3>\n    </div>\n    \n    <div class=\"quick-access\">\n      <h3>\ud83d\udd17 Acc\u00e8s Rapide</h3>\n      <p><strong>Lien direct:</strong> <a href=\"{{ $json.eventDetails.eventLocation }}\">Cliquez ici pour rejoindre</a></p>\n      <p><strong>Code d'acc\u00e8s:</strong> {{ $json.accessCredentials.accessCode }}</p>\n      <p><strong>Sauvegardez ce lien</strong> pour un acc\u00e8s rapide demain</p>\n    </div>\n    \n    <div class=\"final-details\">\n      <h3>\u2705 Checklist Finale</h3>\n      <ul>\n        <li>\ud83d\udcf1 Notifications activ\u00e9es</li>\n        <li>\ud83c\udfa7 Audio/micro test\u00e9s</li>\n        <li>\ud83d\udcdd Questions pr\u00e9par\u00e9es</li>\n        <li>\u2615 Caf\u00e9/th\u00e9 pr\u00eat</li>\n        <li>\ud83d\udeaa Rejoindre 5 min avant</li>\n      </ul>\n    </div>\n    \n    <p style=\"color: #666; font-size: 14px; margin-top: 30px;\">\n      Vous recevrez un dernier rappel 2h avant l'\u00e9v\u00e9nement.<br>\n      H\u00e2te de vous voir demain ! \ud83c\udf89\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "contentType": "html"
        },
        "subject": "\ud83d\udea8 Demain - {{ $json.eventDetails.eventTitle }} - Derni\u00e8res infos"
      },
      "typeVersion": 1
    },
    {
      "id": "11",
      "name": "Wait Until 2h Before",
      "type": "n8n-nodes-base.wait",
      "position": [
        2040,
        200
      ],
      "parameters": {
        "unit": "hours",
        "amount": 22,
        "resume": "={{ $json.reminderDates.twoHoursBefore }}"
      },
      "typeVersion": 1
    },
    {
      "id": "12",
      "name": "Send Final Reminder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2240,
        200
      ],
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; margin: 20px; background-color: #f8f9fa; }\n    .container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; }\n    .final-call { text-align: center; margin-bottom: 30px; background: #28a745; color: white; padding: 20px; border-radius: 8px; }\n    .join-now { background: #007bff; color: white; padding: 20px 40px; text-decoration: none; border-radius: 5px; display: inline-block; margin: 20px 0; font-size: 18px; font-weight: bold; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"final-call\">\n      <h2>\ud83c\udfc1 C'est l'heure !</h2>\n      <p>{{ $json.eventDetails.eventTitle }}</p>\n      <h3>Dans 2 heures</h3>\n    </div>\n    \n    <div style=\"text-align: center;\">\n      <a href=\"{{ $json.eventDetails.eventLocation }}\" class=\"join-now\">\n        \ud83d\ude80 Rejoindre maintenant\n      </a>\n    </div>\n    \n    <p style=\"text-align: center; color: #666; font-size: 14px; margin-top: 30px;\">\n      Code d'acc\u00e8s: {{ $json.accessCredentials.accessCode }}<br>\n      \u00c0 tout de suite ! \ud83c\udf89\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "contentType": "html"
        },
        "subject": "\ud83c\udfc1 MAINTENANT - {{ $json.eventDetails.eventTitle }} commence dans 2h"
      },
      "typeVersion": 1
    },
    {
      "id": "13",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2140,
        60
      ],
      "parameters": {
        "width": 240,
        "height": 160,
        "content": "## Post-Event Follow-up\n\n\ud83d\udcca **After event completion:**\n- Thank you email\n- Feedback survey\n- Resource sharing\n- Next event invitations"
      },
      "typeVersion": 1
    },
    {
      "id": "14",
      "name": "Track Registration",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        450
      ],
      "parameters": {
        "values": {
          "values": [
            "={{ $json.registrationId }}",
            "={{ $json.name }}",
            "={{ $json.email }}",
            "={{ $json.company }}",
            "={{ $json.eventDetails.eventTitle }}",
            "={{ $json.registeredAt }}",
            "={{ $json.status }}"
          ]
        },
        "resource": "sheet",
        "operation": "appendRow",
        "sheetName": "Event Registrations",
        "documentId": "your-google-sheet-id"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Event Settings": {
      "main": [
        [
          {
            "node": "Validate Registration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Week Reminder": {
      "main": [
        [
          {
            "node": "Wait Until Day Before",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Registration": {
      "main": [
        [
          {
            "node": "Send Confirmation Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Track Registration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Until 2h Before": {
      "main": [
        [
          {
            "node": "Send Final Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Registration": {
      "main": [
        [
          {
            "node": "Process Registration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Until Day Before": {
      "main": [
        [
          {
            "node": "Send Day Before Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Until Week Before": {
      "main": [
        [
          {
            "node": "Send Week Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Confirmation Email": {
      "main": [
        [
          {
            "node": "Wait Until Week Before",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Day Before Reminder": {
      "main": [
        [
          {
            "node": "Wait Until 2h Before",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Event Registration Webhook": {
      "main": [
        [
          {
            "node": "Event Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}