{
  "name": "Bella - Landing Page Generator",
  "nodes": [
    {
      "id": "d1356ff1-c445-4963-aa7d-dc210ed0ec7f",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "bella-gen-page",
        "responseMode": "responseNode"
      }
    },
    {
      "id": "adac63de-71cb-46a7-844d-b9c61641394b",
      "name": "Code: Validate & Build Slug",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        0
      ],
      "parameters": {
        "jsCode": "const b = $input.first().json.body || $input.first().json;\nconst school = b.school_name || 'School';\nlet slug = (b.slug || school).toString().toLowerCase().replace(/[^a-z0-9\\s-]/g,'').trim().replace(/\\s+/g,'-').replace(/-+/g,'-').substring(0,60);\nreturn [{ json: {\n  school_name: school,\n  contact_name: b.contact_name || 'there',\n  citation_no: b.citation_no || b.citation_number || 'on file',\n  citation_date: b.citation_date || b.date_served || 'recently',\n  fine: b.fine || '',\n  violation: b.violation || b.citation_topic || b.citation_type || 'a BPPE compliance issue',\n  use_case: b.use_case || 'compliance',\n  custom_hook: b.custom_hook || b.personalized_hook || '',\n  slug\n}}];"
      }
    },
    {
      "id": "4c1b534d-fe15-4f86-b058-7f989e888dcb",
      "name": "Note: Landing Page Server",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        -120
      ],
      "parameters": {
        "content": "Landing page server at localhost:8090. Update domain in Handle Response node.",
        "height": 100,
        "width": 360,
        "color": 4
      }
    },
    {
      "id": "0ca5a0a7-779a-4b33-81d6-d215959ffac8",
      "name": "HTTP Request: Deploy Page",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        560,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "http://bella-lp:8090/school",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ school_name:$json.school_name, contact_name:$json.contact_name, citation_no:$json.citation_no, citation_date:$json.citation_date, fine:$json.fine, violation:$json.violation, use_case:$json.use_case, custom_hook:$json.custom_hook, slug:$json.slug }) }}",
        "options": {}
      }
    },
    {
      "id": "ace6c973-d3a8-4567-b728-a3588f3f51c9",
      "name": "Code: Handle Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        840,
        0
      ],
      "parameters": {
        "jsCode": "const r=$input.first().json;\nreturn [{ json: { success:true, page_url: r.page_url, slug: r.slug } }];"
      }
    },
    {
      "id": "d4cba794-483a-4162-a26f-4e0d831a653a",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1120,
        0
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { success: true, page_url: $json.page_url, slug: $json.slug } }}"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Code: Validate & Build Slug",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Validate & Build Slug": {
      "main": [
        [
          {
            "node": "HTTP Request: Deploy Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request: Deploy Page": {
      "main": [
        [
          {
            "node": "Code: Handle Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Handle Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}