{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5a296cb8-2577-4498-b289-4f3bfdd0bfee",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "DA PA Checker",
        "formFields": {
          "values": [
            {
              "fieldLabel": "website",
              "requiredField": true
            }
          ]
        },
        "formDescription": "DA PA Checker"
      },
      "typeVersion": 2.2
    },
    {
      "id": "f371c55e-1bd5-485a-a430-6133f40db31d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        540,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "dcbbd969-1369-457d-a843-be174c25757e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "76289667-505a-4749-a92f-7970bd085106",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        -20
      ],
      "parameters": {
        "columns": {
          "value": {
            "da": "={{ $json.da }}",
            "dr": "={{ $json.dr }}",
            "pa": "={{ $json.pa }}",
            "website": "={{ $('On form submission').item.json.website }}",
            "spam score": "={{ $json.spam_score }}",
            "organic traffic ": "={{ $json.org_traffic }}"
          },
          "schema": [
            {
              "id": "website",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "da",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "da",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pa",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "pa",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "spam score",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "spam score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "dr",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "dr",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organic traffic ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "organic traffic ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "website"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fR7VFM-vxVcJLc96ESXstah_4U4qJeiRRjZFk_xhL9g",
          "cachedResultUrl": "",
          "cachedResultName": "DAPA"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "fd6f9c88-de97-42cd-a0ea-2ad88dd4b5fc",
      "name": "DA PA API Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        0
      ],
      "parameters": {
        "url": "https://moz-da-pa-checker.p.rapidapi.com/dapa.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "website",
              "value": "={{ $json.website }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "moz-da-pa-checker.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "412189ff-e401-4d44-b0b7-45a52272a91c",
      "name": "Clean Output",
      "type": "n8n-nodes-base.code",
      "position": [
        820,
        -20
      ],
      "parameters": {
        "jsCode": "\nreturn $input.first().json.data;"
      },
      "typeVersion": 2
    },
    {
      "id": "e9b714c4-224e-4f17-ad40-def31cb1cc9d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -220
      ],
      "parameters": {
        "width": 580,
        "height": 960,
        "content": "# Automated Domain Authority (DA) & Page Authority (PA) Checker with Google Sheets Integration\n\n### Description\n### Easily collect website URLs via form, retrieve Domain Authority (DA), Page Authority (PA), Domain Rating (DR), Spam Score, and Organic Traffic using a Moz API, and store the results in Google Sheets \u2014 fully automated using n8n.\n\n---\n\n## Node-by-Node Explanation\n\n### 1. **On form submission** (`formTrigger`)\nTriggers the workflow when a user submits a form containing a website URL.\n\n### 2. **DA PA API Request** (`httpRequest`)\nSends a **POST request** to the **Moz DA/PA API** to fetch SEO metrics for the provided website.\n\n### 3. **If** (`if`)\nChecks if the API response returns a successful result (`success === true`).\n\n### 4. **Clean Output** (`code`)\nExtracts relevant data such as **DA**, **PA**, **Spam Score**, **DR**, and **Organic Traffic** from the API response for further processing.\n\n### 5. **Google Sheets** (`googleSheets`)\nAppends the extracted SEO metrics into a **Google Sheet** under the specified columns, mapped by the **website URL**.\n\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1e796e18-2521-4a91-bce1-f4cef94c0de7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -220
      ],
      "parameters": {
        "height": 400,
        "content": "## 1. On form submission\nTriggers the workflow when a form is submitted.  \nCollects the `website` field as input."
      },
      "typeVersion": 1
    },
    {
      "id": "683512e1-b6f4-4993-b951-13869e3d1826",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -220
      ],
      "parameters": {
        "height": 400,
        "content": "## 2. DA PA API Request\nSends the website to the Moz DA/PA API via RapidAPI.  \nReceives domain metrics in the response."
      },
      "typeVersion": 1
    },
    {
      "id": "b781f084-a575-4ad5-abc2-06e8d59b1f22",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -220
      ],
      "parameters": {
        "height": 400,
        "content": "## 3. If\nChecks if the API response `success` is true.  \nContinues only when data was fetched successfully."
      },
      "typeVersion": 1
    },
    {
      "id": "02498b33-59ee-43e4-ac83-a54dfc6b7504",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -220
      ],
      "parameters": {
        "height": 400,
        "content": "## 4. Clean Output\nExtracts only the `data` section from the API result.  \nPrepares clean key-value pairs for saving."
      },
      "typeVersion": 1
    },
    {
      "id": "26f9be8e-67fc-467c-a3f8-621499b7d2f1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -220
      ],
      "parameters": {
        "height": 400,
        "content": "## 5. Google Sheets\nAppends the cleaned data into a Google Sheet.  \nStores website, DA, PA, spam score, DR, and organic traffic."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Clean Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Output": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DA PA API Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "DA PA API Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}