{
  "id": "Blqj7wuFdGXBz3Sm",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Domain Keyword Ranking + AI Summarization with SE Ranking + OpenAI GPT 4.1-mini",
  "tags": [
    {
      "id": "Kujft2FOjmOVQAmJ",
      "name": "Engineering",
      "createdAt": "2025-04-09T01:31:00.558Z",
      "updatedAt": "2025-04-09T01:31:00.558Z"
    },
    {
      "id": "ZOwtAMLepQaGW76t",
      "name": "Building Blocks",
      "createdAt": "2025-04-13T15:23:40.462Z",
      "updatedAt": "2025-04-13T15:23:40.462Z"
    },
    {
      "id": "ddPkw7Hg5dZhQu2w",
      "name": "AI",
      "createdAt": "2025-04-13T05:38:08.053Z",
      "updatedAt": "2025-04-13T05:38:08.053Z"
    },
    {
      "id": "qpxJxOMCv2x7Op5c",
      "name": "SERP",
      "createdAt": "2025-04-03T15:37:19.686Z",
      "updatedAt": "2025-04-03T15:37:19.686Z"
    }
  ],
  "nodes": [
    {
      "id": "f3cad1ad-95d9-4b85-9314-481ffb4426d3",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -960,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "08dc5dbe-de7a-4e74-bcd8-4ced909ebdf3",
      "name": "Set the Input Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -736,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "51fefe77-637c-456c-b037-e53b76e74fc5",
              "name": "target_site",
              "type": "string",
              "value": "seranking.com"
            },
            {
              "id": "24725cc6-edeb-4c8d-b8e7-31d58ae53822",
              "name": "type",
              "type": "string",
              "value": "organic"
            },
            {
              "id": "cf825d67-60e7-4505-b6be-d67d0fb8f98f",
              "name": "limit",
              "type": "string",
              "value": "100"
            },
            {
              "id": "6e1a9d36-7281-4c7b-86a9-92ffe5a38398",
              "name": "filter",
              "type": "string",
              "value": "sitelinks"
            },
            {
              "id": "dd15a8ce-75c8-4dad-98ba-2fe8224ad1b5",
              "name": "source",
              "type": "string",
              "value": "us"
            },
            {
              "id": "0db7da67-55ad-4394-a372-117c97db1815",
              "name": "columns",
              "type": "string",
              "value": "keyword,cpc,volume,snippet_title,competition,difficulty,url,total_sites,traffic,traffic_percent,price,serp_features,intents"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d8cf41b0-7a5b-4239-8fdf-2fb14c7eb525",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -256,
        240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6e9bf354-bb94-4a0e-b33d-9f26c7884328",
      "name": "SE Ranking AI Summarizer",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -256,
        32
      ],
      "parameters": {
        "text": "=Use the following JSON to come up with an overview. Provide a human friendly descrptive and comprehensive summary\n{{ $json.toJsonString() }}\n",
        "options": {},
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"comprehensive_summary\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n      \"abstract_summary\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 1.2
    },
    {
      "id": "e15822ab-11b7-4a84-a2b4-0bfe89e7eb3a",
      "name": "Create a Binary Data",
      "type": "n8n-nodes-base.function",
      "position": [
        800,
        16
      ],
      "parameters": {
        "functionCode": "items[0].binary = {\n  data: {\n    data: new Buffer(JSON.stringify(items[0].json, null, 2)).toString('base64')\n  }\n};\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "909daa52-67ce-47f4-81b5-3cd82a730751",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 976,
        "height": 752,
        "content": "## Data Enrichment\n\nCombines raw SE Ranking metrics with OpenAI-generated summaries. Transforms analytical data into human-readable insights. Merge the response from the Summarization + SE Ranking Domain Analysis. Also perform data aggregation for downstream consumption."
      },
      "typeVersion": 1
    },
    {
      "id": "84661333-3e35-41fe-b318-18f02816083e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 752,
        "content": "## Export Data Handling\n\nConverts enriched results into structured JSON output. Stores the final data for reporting and downstream automation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "eb7deb8c-c410-4044-a2da-65ac50870f98",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 752,
        "content": "##  SE Ranking Domain Keyword Ranking\n\nRetrieves keyword ranking data for a specified domain or exact URL from a regional database. Supports organic and paid results and provides advanced filtering across keyword properties, SERP features, search intents, and traffic metrics."
      },
      "typeVersion": 1
    },
    {
      "id": "316007fc-dace-46e8-8fc9-376a5f8d9083",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -144
      ],
      "parameters": {
        "width": 496,
        "height": 752,
        "content": "## **How It Works**\n\nThis workflow analyzes keyword ranking performance for a domain using SE Ranking and enriches the results with AI-generated summaries. It begins with a manual trigger where the target domain, search type (organic or paid), region, result limits, and keyword filters are defined. \n\nThese parameters are sent to the **SE Ranking Domain Keywords API** to retrieve detailed keyword ranking data, including positions, search volume, CPC, competition, SERP features, intents, and estimated traffic.\n\n\n## **Setup Instructions**\n\n1. Configure credentials:\n   * **SE Ranking API** using HTTP Header Authentication\n   * **OpenAI API** for GPT-4.1-mini\n2. Update the **Set the Input Fields** node with your domain, region, filters, and limits.\n3. Verify the output file path in the **Write File to Disk** node.\n4. Click **Execute Workflow** to generate keyword ranking insights.\n\n\n## **Customize**\n\n* Switch between organic and paid keyword analysis.\n* Modify columns, filters, or limits to focus on specific SEO metrics.\n* Adjust the OpenAI prompt to generate competitive insights or action items.\n* Replace file export with dashboards, databases, or alerting workflows.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4123aa91-b1d7-4f6c-a0f1-fbddff1212a8",
      "name": "SE Ranking Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -512,
        160
      ],
      "parameters": {
        "url": "https://api.seranking.com/v1/domain/keywords",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "source",
              "value": "={{ $json.source }}"
            },
            {
              "name": "url",
              "value": "={{ $json.target_site }}"
            },
            {
              "name": "type",
              "value": "={{ $json.type }}"
            },
            {
              "name": "limit",
              "value": "={{ $json.limit }}"
            },
            {
              "name": "filter[serp_features]",
              "value": "={{ $json.filter }}"
            },
            {
              "name": "cols",
              "value": "={{ $json.columns }}"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 4.3
    },
    {
      "id": "c584bd66-edb6-4cf0-adc5-9507f0b7d2e9",
      "name": "Extract Raw Response",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        208
      ],
      "parameters": {
        "jsCode": "return [{\n  \"domain_keywords_response\":$('SE Ranking Request').first().json\n}]"
      },
      "retryOnFail": false,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "a9459ec3-3ffc-450b-bbf0-0f2d4e23e78b",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        512,
        96
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "d369774a-cf01-4704-9873-a396556a74c9",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        320,
        96
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "6cbace7b-828f-45ea-a012-8f4c41845b45",
      "name": "Extract Summary",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        32
      ],
      "parameters": {
        "jsCode": "return [{\n  \"summary\": $input.first().json.output\n}]"
      },
      "retryOnFail": false,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "8c0acd5d-7dde-40bc-98dd-c7d16bbcdae7",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -528
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 368,
        "content": "![Logo](https://s3-eu-west-1.amazonaws.com/tpd/logos/538f1575000064000578dee6/0x0.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "79a6dd94-c695-460d-9f90-722d94d35f64",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1008,
        16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "3476a792-95d4-48f6-babd-b8b0db78ce10",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        416
      ],
      "parameters": {
        "columns": {
          "value": {
            "json_data": "={{ $json.data.toJsonString() }}"
          },
          "schema": [
            {
              "id": "json_data",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "json_data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "json_data"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sg9dAAl4NJu8mO-rYV9CTHdSL6GLw3FaPvfrNOvkhu8/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1sg9dAAl4NJu8mO-rYV9CTHdSL6GLw3FaPvfrNOvkhu8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sg9dAAl4NJu8mO-rYV9CTHdSL6GLw3FaPvfrNOvkhu8/edit?usp=drivesdk",
          "cachedResultName": "Domain Keyword Rankings"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a926166f-9623-429d-95d9-faf38376454c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -480
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 320,
        "content": "## Usecases\n\n- SEO performance monitoring\n\n- Executive and client reporting\n\n- Keyword opportunity discovery\n\n- Competitive domain analysis\n\n- Scalable SEO automation \n"
      },
      "typeVersion": 1
    },
    {
      "id": "428d0014-d675-46da-9d08-3a74625df3b1",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -480
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 320,
        "content": "## Output\n\n- Structured keyword ranking data\n\n-  AI-generated summaries and insights\n\n-  Export-ready JSON for reporting and automation\n"
      },
      "typeVersion": 1
    },
    {
      "id": "01bd61f2-2f9e-4d4f-8fa5-608d1c5f2f41",
      "name": "Persist on DataTable",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        800,
        208
      ],
      "parameters": {
        "columns": {
          "value": {
            "data": "={{ $json.data.toJsonString() }}"
          },
          "schema": [
            {
              "id": "data",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "data",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "data"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "Af5tH3rRO7zLO2bZ",
          "cachedResultUrl": "/projects/OFZrD6piltNz73Y6/datatables/Af5tH3rRO7zLO2bZ",
          "cachedResultName": "DomainKeywordRanking"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aac699f1-8c70-4160-a419-22a8656cecd4",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Create a Binary Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Persist on DataTable",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        []
      ]
    },
    "Extract Summary": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "SE Ranking AI Summarizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "SE Ranking Request": {
      "main": [
        [
          {
            "node": "SE Ranking AI Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a Binary Data": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Raw Response": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set the Input Fields": {
      "main": [
        [
          {
            "node": "SE Ranking Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SE Ranking AI Summarizer": {
      "main": [
        [
          {
            "node": "Extract Summary",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Raw Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set the Input Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}