{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "6171e049-fc10-40eb-953d-854e1a456b14",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -20,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "Webpage Analyzer ",
        "formFields": {
          "values": [
            {
              "fieldLabel": "url",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Webpage Analyzer"
      },
      "typeVersion": 2.2
    },
    {
      "id": "e2c73dbf-208b-4975-9435-f100e80e10e1",
      "name": "WebPage Analyzer ",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        0
      ],
      "parameters": {
        "url": "https://landing-page-analyzer-ai.p.rapidapi.com/analyse.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.url }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "landing-page-analyzer-ai.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8505b630-0f5d-47a6-ba30-61bb2a038d9b",
      "name": "Reformat",
      "type": "n8n-nodes-base.code",
      "position": [
        500,
        0
      ],
      "parameters": {
        "jsCode": "// Assume input is in items[0].json$input.first().json.grade\nconst feedback = $input.first().json;\n\nfunction formatSuggestions(suggestions) {\n  return suggestions.map((s, index) => {\n    return `### ${index + 1}. ${s.category.toUpperCase()}\n- **Issue**: ${s.whatIsTheIssue}\n- **Why it Matters**: ${s.whyItMatters}\n- **How to Fix**: ${s.howToFix}\n- **Priority**: ${s.priority.toUpperCase()}\\n`;\n  }).join('\\n');\n}\n\nfunction formatStrengths(strengths) {\n  return strengths.map(s => `- ${s}`).join('\\n');\n}\n\nfunction formatScores(scores) {\n  return Object.entries(scores)\n    .map(([k, v]) => `- **${k}**: ${v}`)\n    .join('\\n');\n}\n\nconst docText = `\n# Conversion Audit Report\n\n**Grade:** ${feedback.grade}  \n**Overall Score:** ${feedback.score}/100\n\n---\n\n## Suggestions for Improvement\n\n${formatSuggestions(feedback.suggestions)}\n\n---\n\n## Strengths\n\n${formatStrengths(feedback.strengths)}\n\n---\n\n## Conversion Score Breakdown\n\n${formatScores(feedback.conversionScore)}\n`;\n\nreturn [\n  {\n    json: {\n      docText\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "57ea065e-e5ad-446e-a96d-2d2ee5b9aeff",
      "name": "Upload In Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        760,
        0
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $json.docText }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "",
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "3f3db297-9053-4c05-bf0d-3b922d2e65a3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -360
      ],
      "parameters": {
        "width": 760,
        "height": 880,
        "content": "# \ud83d\ude80 Automated Webpage Analyzer & Google Docs Report Generator  \n\n## Description  \nThis **n8n workflow** analyzes any webpage URL using the [Landing Page Analyzer API](https://rapidapi.com/), reformats the insights into a professional **Conversion Audit Report**, and automatically saves the results into **Google Docs** for easy sharing and record-keeping.  \n\n---\n\n## \ud83d\udd04 Workflow Nodes (Step by Step)  \n\n1. **On form submission** \u2013 Collects the webpage URL from a simple form.  \n2. **WebPage Analyzer (API Call)** \u2013 Sends the URL to the Landing Page Analyzer API (via RapidAPI) to get an SEO & conversion-focused audit.  \n3. **Reformat (Code Node)** \u2013 Transforms the API response into a structured Markdown-style audit report (with grade, strengths, suggestions, and score breakdown).  \n4. **Upload In Google Docs** \u2013 Inserts the formatted report directly into a pre-configured Google Doc for permanent storage and collaboration.  \n\n---\n\n## \u2728 Benefits  \n- Fully automated **SEO & Conversion Audit reports**  \n- Saves results directly to **Google Docs** (no manual copy-paste)  \n- Scalable and reusable for multiple websites  \n- Great for **SEO agencies, freelancers, and digital marketers**  \n\n---\n"
      },
      "typeVersion": 1
    },
    {
      "id": "db423981-23ea-49e3-b70d-71d97f4aeab9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -140
      ],
      "parameters": {
        "height": 280,
        "content": " **On form submission**  \n   Captures the website URL entered by the user through a form trigger.  \n   This acts as the starting point for the entire workflow.  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "c1885eb1-2dee-42ec-b31d-8f39aa2f789f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -140
      ],
      "parameters": {
        "height": 280,
        "content": " **WebPage Analyzer (API Call)**  \n   Sends the captured URL to the Landing Page Analyzer API via RapidAPI.  \n   Retrieves audit details like grade, score, suggestions, and strengths.  "
      },
      "typeVersion": 1
    },
    {
      "id": "ee953e2b-70a7-422c-b528-7bcdbb6ccd1f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -140
      ],
      "parameters": {
        "height": 280,
        "content": "**Reformat (Code Node)**  \n   Processes the API response into a clean, human-readable audit report.  \n   Organizes sections into suggestions, strengths, and conversion score breakdown. "
      },
      "typeVersion": 1
    },
    {
      "id": "86453a67-6bb8-4dc6-91e7-1a7de238fdeb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        -140
      ],
      "parameters": {
        "height": 280,
        "content": "**Upload In Google Docs**  \n   Inserts the formatted audit report into a pre-configured Google Document.  \n   Ensures reports are stored, shareable, and accessible for collaboration."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Reformat": {
      "main": [
        [
          {
            "node": "Upload In Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WebPage Analyzer ": {
      "main": [
        [
          {
            "node": "Reformat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "WebPage Analyzer ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}