Skip to content

In n8n, copy this file and paste it onto the canvas, or use Import from File.

{
  "name": "18 - Demo Company Websites (for testing)",
  "nodes": [
    {
      "parameters": {
        "path": "demo-sites/:site",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "m18d-webhook",
      "name": "Demo Site",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "course-18-demo-sites"
    },
    {
      "parameters": {
        "jsCode": "// Three fake company homepages so enrichment can be tested offline and deterministically.\n// GET /webhook/course-18-demo-sites/demo-sites/<site>\nconst SITES = {\n  'acme-dental': `<!doctype html><html><head>\n<title>Acme Family Dental | Dentist in Austin, TX</title>\n<meta name=\"description\" content=\"Gentle family and cosmetic dentistry in Austin. Same-week appointments, most insurance accepted.\">\n<link rel=\"stylesheet\" href=\"/wp-content/themes/dental/style.css\">\n<script src=\"https://www.googletagmanager.com/gtag/js?id=G-TEST\"></script>\n</head><body>\n<h1>Your Neighborhood Dentist Since 2009</h1>\n<p>Acme Family Dental offers cleanings, implants, Invisalign and emergency dental care for the whole family. 3 locations across Austin.</p>\n<a href=\"https://calendly.com/acme-dental/new-patient\">Book an appointment</a>\n<p>Call us: (512) 555-0142 · hello@acmedental.example</p>\n<p>We're hiring! See our <a href=\"/careers\">careers</a> page for hygienist and front desk roles.</p>\n<a href=\"https://www.linkedin.com/company/acme-family-dental\">LinkedIn</a> <a href=\"https://www.facebook.com/acmedental\">Facebook</a>\n<address>1200 Congress Ave, Austin, TX 78701</address>\n</body></html>`,\n  'byte-saas': `<!doctype html><html><head>\n<title>ByteLedger – Accounting software for e-commerce brands</title>\n<meta name=\"description\" content=\"Automated bookkeeping for Shopify and Amazon sellers.\">\n<script type=\"text/javascript\" id=\"hs-script-loader\" src=\"//js.hs-scripts.com/123456.js\"></script>\n</head><body>\n<h1>Close your books in hours, not weeks</h1>\n<p>ByteLedger syncs Shopify, Amazon and Stripe into clean accounting. Trusted by 1,200 online brands.</p>\n<p>We're hiring engineers and customer success managers.</p>\n<a href=\"https://www.linkedin.com/company/byteledger\">LinkedIn</a> <a href=\"https://x.com/byteledger\">X</a>\n<p>Contact sales: sales@byteledger.example</p>\n</body></html>`,\n  'blank-hobby': `<!doctype html><html><head><title>Jo's corner</title></head><body>\n<h1>Hi, I'm Jo</h1><p>I write about sourdough and hiking. Thanks for stopping by!</p>\n</body></html>`,\n};\nconst site = $input.first().json.params.site;\nconst html = SITES[site];\nreturn [{ json: { status: html ? 200 : 404, html: html ?? '<h1>404 Not Found</h1>' } }];\n"
      },
      "id": "m18d-pages",
      "name": "Pages",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "={{ $json.html }}",
        "options": {
          "responseCode": "={{ $json.status }}",
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "text/html; charset=utf-8"
              }
            ]
          }
        }
      },
      "id": "m18d-respond",
      "name": "Serve HTML",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        440,
        0
      ]
    }
  ],
  "connections": {
    "Demo Site": {
      "main": [
        [
          {
            "node": "Pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pages": {
      "main": [
        [
          {
            "node": "Serve HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  }
}