{
  "name": "BEL'R — Proposition événement agenda",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "belr-agenda-proposition",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-in",
      "name": "Webhook — Réception proposition",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1.1,
      "position": [240, 300],
      "webhookId": "belr-agenda-proposition"
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": false },
          "conditions": [
            {
              "id": "check-honeypot",
              "leftValue": "={{ $json.body._honeypot }}",
              "rightValue": "",
              "operator": { "type": "string", "operation": "equals" }
            }
          ]
        }
      },
      "id": "filter-spam",
      "name": "Filtre anti-spam (honeypot)",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [460, 300]
    },
    {
      "parameters": {
        "fromEmail": "noreply@belr-hautanjou.fr",
        "toEmail": "contact@belr-hautanjou.fr",
        "subject": "=[Agenda BEL'R] Nouvelle proposition : {{ $json.body.title }}",
        "emailType": "html",
        "message": "=<h2>Nouvelle proposition d'événement</h2>\n<table style='border-collapse:collapse;width:100%'>\n<tr><th style='text-align:left;padding:8px;background:#f5f5f5'>Champ</th><th style='text-align:left;padding:8px;background:#f5f5f5'>Valeur</th></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Titre</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.title }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Date début</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.event_start }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Lieu</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.location }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Commune</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.commune }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Thématiques</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.thematiques }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Description</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.description }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Organisateur</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.organizer }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Contact</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.contact_name }} — {{ $json.body.contact_email }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>URL</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.url }}</td></tr>\n<tr><td style='padding:8px;border:1px solid #ddd'><strong>Soumis le</strong></td><td style='padding:8px;border:1px solid #ddd'>{{ $json.body.submitted_at }}</td></tr>\n</table>\n<p style='margin-top:16px'><strong>Actions :</strong></p>\n<ul>\n<li><a href='https://nextcloud.belr-hautanjou.fr/apps/calendar/'>Ajouter dans Nextcloud Calendar</a></li>\n</ul>",
        "options": {}
      },
      "id": "email-admin",
      "name": "Email — Notification équipe BEL'R",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [680, 200]
    },
    {
      "parameters": {
        "fromEmail": "noreply@belr-hautanjou.fr",
        "toEmail": "={{ $('Webhook — Réception proposition').item.json.body.contact_email }}",
        "subject": "=[Agenda BEL'R] Confirmation de réception — {{ $('Webhook — Réception proposition').item.json.body.title }}",
        "emailType": "html",
        "message": "=<h2>Merci pour votre proposition !</h2>\n<p>Bonjour {{ $('Webhook — Réception proposition').item.json.body.contact_name }},</p>\n<p>Nous avons bien reçu votre proposition d'événement :</p>\n<ul>\n<li><strong>{{ $('Webhook — Réception proposition').item.json.body.title }}</strong></li>\n<li>Date : {{ $('Webhook — Réception proposition').item.json.body.event_start }}</li>\n<li>Lieu : {{ $('Webhook — Réception proposition').item.json.body.location }}</li>\n</ul>\n<p>Notre équipe l'examinera sous 48h et vous confirmera la publication.</p>\n<p>Cordialement,<br>L'équipe BEL'R Haut-Anjou</p>\n<hr>\n<p style='font-size:0.8em;color:#666'>BEL'R Haut-Anjou · Lieu-dit Bel-Air · 53200 Prée-d'Anjou · <a href='https://belr-hautanjou.fr'>belr-hautanjou.fr</a></p>",
        "options": {}
      },
      "id": "email-confirm",
      "name": "Email — Confirmation au proposant",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [680, 400]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"success\": true, \"message\": \"Proposition reçue\" }",
        "options": { "responseCode": 200 }
      },
      "id": "respond-ok",
      "name": "Réponse HTTP 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [900, 300]
    }
  ],
  "connections": {
    "Webhook — Réception proposition": {
      "main": [[{ "node": "Filtre anti-spam (honeypot)", "type": "main", "index": 0 }]]
    },
    "Filtre anti-spam (honeypot)": {
      "main": [
        [
          { "node": "Email — Notification équipe BEL'R", "type": "main", "index": 0 },
          { "node": "Email — Confirmation au proposant", "type": "main", "index": 0 }
        ]
      ]
    },
    "Email — Notification équipe BEL'R": {
      "main": [[{ "node": "Réponse HTTP 200", "type": "main", "index": 0 }]]
    }
  },
  "settings": { "executionOrder": "v1" },
  "tags": ["BEL'R", "Agenda"]
}
